aspose file tools*
The moose likes Object Relational Mapping and the fly likes How to catch Oracle error codes and error message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to catch Oracle error codes and error message" Watch "How to catch Oracle error codes and error message" New topic
Author

How to catch Oracle error codes and error message

Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Hi All,
I am trying to run oracle procedure/Function using Hibernate 3. I want to catch error raised by oracle procedure/Function and display error message to user.

By using this code I can able to run only procedures and If any error occured in procedure my control is going to SQLException block. I want to check the error message.
Please check this code and let me know is this correct way to call procedure??
Please share document related to calling procedure from hibernate.

Thanks.
hildich kilal
Ranch Hand

Joined: Aug 25, 2008
Posts: 44
This is the right way you call stored proc from hibernate.
Are you not getting error code in SQLException object? What exactly is your requirement?

Thanks
HK
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Hi Kilal,
I'm getting error code in SQLException block, but i want to get error codes in execute statement only.
and what about if function will return some object??
hildich kilal
Ranch Hand

Joined: Aug 25, 2008
Posts: 44
You can handle exception in Stored procedure (in EXCEPTION block) assign the error code and error message to two variables. Set these variables as OUT parameters in your stored procedure.

Read them after execute. This way SQLException will not be thrown.

Hope this helps.
HK
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to catch Oracle error codes and error message