wood burning stoves 2.0*
The moose likes JDBC and the fly likes SQLExceptions: List of error codes for oracle? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQLExceptions: List of error codes for oracle?" Watch "SQLExceptions: List of error codes for oracle?" New topic
Forums: JDBC Oracle/OAS
Author

SQLExceptions: List of error codes for oracle?

arfeen khan
Greenhorn

Joined: May 13, 2011
Posts: 25
Hello There,

I am trying to handle SQLExceptions. The database used is Oracle 11g.
The purpose is to show user friendly messages based on the error codes.
To do this, i can find one way to go for error codes.
In the catch i will write switch statement having cases for different error codes and i will show
user friendly messages based on that.

The problem is, i did not found the list of error codes for oracle.
Can anybody please help on this.

Thanks,
Arfeen.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

There is really, really a lot of them: http://docs.oracle.com/cd/E14072_01/server.112/e10880/e0.htm

In my opinion, most of them are not well suited to be shown to end users. Lots of them are connected to some low-level operation (say, additional space cannot be allocated for table or index). Either the user can administer the database, in which case he'll understand the message, or he cannot, in which case all he needs to do is to pass the message on to a DBA. If he'll pass a user-friendly message instead, the DBA might not understand what happened.

I personally only handle ORA-00001 (unique constraint violated) and ORA-02292 (integrity constraint violated - child record found). There could be a few others to handle this way, but not much. For all others I create an error report (a zip file) that contains the stack trace, log files and other diagnostic information, and display just a generic message ("An error occurred processing XXX. Please send the error report to ..."). Actually, this is how I handle all uncaught exceptions. (It is a Swing application, a web application might manage the error reporting a bit differently.)
arfeen khan
Greenhorn

Joined: May 13, 2011
Posts: 25
Thank you so much Martin for the descriptive link and your sincere suggestion.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQLExceptions: List of error codes for oracle?
 
Similar Threads
ActionError vs. ActionMessges Question
The best way to catch Oracle exceptions
Exceptions
Exceptions
Servlet code causes webserver to crash - sometimes