File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes SQLException beteen correlation and exposed name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "SQLException beteen correlation and exposed name" Watch "SQLException beteen correlation and exposed name" New topic
Author

SQLException beteen correlation and exposed name

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Hi there,

I have a little problem with a SQL query I'm running. when ran in SQL this query is fine, but put it into a Java class and call it from a servlet and I get this error.

java.sql.SQLException: The correlation name 'TABLENAME' has the same exposed name as table 'TABLENAME'.

Never seen this before and can;t see anything wrong with the SQL. Anyone seen this error befopre and know what causes it?

Cheers
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
Can you tell us what db you're using and maybe some example SQL (the DDL used to construct the tables might help too) which causes this problem?


James Carman, President<br />Carman Consulting, Inc.
Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Sure it's a SQL 7 DB and the code is:

SELECT tblJobHeaders.job_number, tblWorkflows.wf_name, tblWorkflowAttributes.att_name, tblSystemKeys.key_description, tblUsers.fname, tblUsers.sname
FROM tblWorkflowLinkList, tblWorkflows, tblWorkflowAttributes, tblJobHeaders, tblJobRepros, tblSystemKeys, tblUsers
WHERE tblWorkflowAttributes.id = tblWorkflowLinkList.current_processid AND
tblWorkflowAttributes.wf_id = tblWorkflows.id AND
tblWorkflowLinkList.process_state = tblSystemKeys.id AND
tblWorkflowLinkList.wf_id = tblWorkflows.id AND
tblJobHeaders.id = tblWorkflowLinkList.jobnumber_id AND
tblJobHeaders.id = tblJobRepros.jobheader_id AND
tblUsers.id = tblWorkflows.createdby_id AND
tblJobRepros.user_id = [userid] (user ID is stored in HTTP session).

Sorry the SQLs quite long.

The table is seems to be having problems with is
'tblWorkflowAttributes', but as I say, put the same query in Enterprise Manager and it runs fine.
Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Sorted it, I'm an idiot. No space between one of the tablenames and an 'AND'!!!

sometimes the simplest answer...

Cheers anyways
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQLException beteen correlation and exposed name
 
Similar Threads
help with getting the table name from the user input
Adding elements to a database!
Create procedure for inserting record into table : Table name dynamically as an Param
Correlation in SQL to distinguish tables
SQL Injection prevention