• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQLException beteen correlation and exposed name

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorted it, I'm an idiot. No space between one of the tablenames and an 'AND'!!!

sometimes the simplest answer...

Cheers anyways
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic