Discussions
Categories
- 196.8K All Categories
- 2.2K Data
- 239 Big Data Appliance
- 1.9K Data Science
- 450.3K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 544 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.9K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.5K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 439 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
How can I get additional information about exception?

I need to extract additional information from sql exception.
For example I get following exception during query execution http://ora-12899.ora-code.com/ I need to extract column name (without table name). I could do that with regular expressions, but that seems to be very fragile as message may depend on client locale and also it could change when oracle version changes.
How can I get such additional information without message parsing?
Answers
-
I'm sorry, but you can't. The exception is it and in this case you're even lucky that the error contains the column name; generally the error is in the form of "it didn't work" without any kind of context-specific information in it such as a table/column name. I've been told this is because that is security-sensitive information. Which makes sense.
-
You can't.
-
I noticed that plsql developer and sqlplus are able to get position in query string that lead to an error.
For example output from sqlplus:
SQL> insert into tbl (data) values('12345')
2 /
insert into tbl (data) values('12345')
*
ERROR at line 1:
ORA-12899: value too large for column "schmnm"."tbl"."data" (actual: 5,
maximum: 3)
For my current needs that would be fine. How can I get position in the query string?
-
This might help (I haven't tried it):
I Googled this:
java getting more information about exception from jdbc driver
and found this:
http://docs.oracle.com/javase/tutorial/jdbc/basics/sqlexception.html
Which says:
A Cause: A SQLException instance might..... consists of one or more Trhowable objects... to navigate
this chain of causes, recursively call the method SQLException.getCause.....
You can probably create a simple program that duplicates the exception you get in order to test the above solution.