3 Replies Latest reply on Jul 9, 2002 1:02 PM by Mark Kent

    Oracle error numbers in exceptions

    Mark Kent Newbie

      I'm trying to handle some common errors in my session bean while communicating with an Oracle 8i database. I've noticed that the exception message thrown one try/catch returns an Oracle error number ("ORA-00001: unique key violation" is part of the returned exception message) while other exceptions do NOT include the exact Oracle error number ("ORA-02292: integrity constraint violated - child record found" simply returns the message "ourapp.name.CustomRemoveException: Could not remove 222" where 222 is the PK trying to be removed).

      Am I missing something basic here?

      We have created custom Create/Find/Remove exception classes that extend the Exception class.

      I do see the exact Oracle error stacktrace in the JBoss server.log file which includes the Oracle error number. However, I'd like to be able to interrogate the returned exception message for the Oracle error number to handle certain cases or show a default error message if the number is not specifically handled.