When writing an app, i ran into this nice exception message thrown by the driver of an informix database.
Makes me wonder, was it not easier to write the correct message right away?
java.sql.SQLException: Message text will be provided in later releases java.lang.IndexOutOfBoundsException
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:448)
at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1034)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:253)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at com.[compname].unloadImporter.databaseHandling.InformixHandler.connect(InformixHandler.java:121)
at com.[compname].informixExporter.InformixExporter.runExport(InformixExporter.java:158)
at com.[compname].informixExporter.InformixExporter.run(InformixExporter.java:121)
at java.lang.Thread.run(Thread.java:534)
Ps. the java.lang.IndexOutOfBoundsException makes no sense, here is the code i wrote that throws the exception:
public boolean connect() throws SQLException{
con = null;
try {
Class.forName(this.databaseDriver).newInstance();
} catch (Exception e) {
throw new SQLException("Unable to load JDBC Driver");
}
try {
con = DriverManager.getConnection(this.connectionURL,
this.username,
this.password);
} catch (Exception e) {
//thrown here
throw new SQLException("Unable to make a connection to informix database:\n\t" + e.getMessage());
}
..etc..