wood burning stoves
The moose likes JDBC and Relational Databases and the fly likes How to get chained SQL warnings 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 "How to get chained SQL warnings" Watch "How to get chained SQL warnings" New topic

How to get chained SQL warnings

David Weise

Joined: Mar 06, 2000
Posts: 3
I am getting an Exception thrown during a database connection.
I am using this:
myConn = DriverManager.getConnection(dbLocation,dbUserName,dbPWD);
The exception thrown is
java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s).
How do I see the SQLWarnings.
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Look up the API on SQLException. There is a method getNextException() which, used iteratively, can lead to a whole mess of other exceptions attached to the one exception object that was actually thrown and caught.

"I'm not back." - Bill Harding, Twister
It is sorta covered in the JavaRanch Style Guide.
subject: How to get chained SQL warnings
It's not a secret anymore!