This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes More detail from SQLException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "More detail from SQLException" Watch "More detail from SQLException" New topic

More detail from SQLException

Leslie Chaim
Ranch Hand

Joined: May 22, 2002
Posts: 336
I have this application and using dynamic SQL I often run in to the ORA-00904: invalid column name error.
From my program how can I report more details such as the table and column name, or better yet is there any way I can get the message from the Oracle engine?
Thanks for your help.

Normal is in the eye of the beholder
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Have you tried the getErrorCode and the getSQLState methods in the SQLException class? Also, make you are using getMessage too.

Leslie Chaim
Ranch Hand

Joined: May 22, 2002
Posts: 336
I tried it all and it does not give me what I am looking for.
After I catch the SQLException I would like to somehow get the complete Oracle message the same as would be returned when using the OCI oerhms() function call.
It is sorta covered in the JavaRanch Style Guide.
subject: More detail from SQLException
It's not a secret anymore!