I have recently changed an application from storing the database username and password in a configuration file (gasp password stored in plain text in a config file, I know, I know).
The application now asks the user to type in her username and password before it can continue.
The new version of the application now has to interrogate the SQLException to determine what caused the exception (invalid user name or password, database server unreachable, connection timeout, etc.) so that it can decide what to do next (prompt the user to correct the username and password, tell the user to try again later once the network issue has been sorted, reconnect invisibly, etc.).
Trying to find the SQLException errorCodes (SQLException.getErrorCode()) that relate to these (and other) causes has been near to impossible and we have been forced to guessing (which at times can be dangerous).
The Java API docs say this is vendor-specific.
Does anyone have the error-codes that can be set by the Sybase JConnect JDBC drivers?
- JRE 1.5
- jConnect for JDBC 2.0 (spec version 5.2)
- Sybase IQ 12.7