con.close();
}
catch (ClassNotFoundException drvEx)
{
System.err.println("Could not load JDBC driver");
System.out.println("Exception: " + drvEx);
drvEx.printStackTrace();
}
catch(SQLException sqlEx)
{
while(sqlEx != null) {
System.err.println("SQLException information");
System.err.println("Error msg: " + sqlEx.getMessage());
System.err.println("SQLSTATE: " + sqlEx.getSQLState());
System.err.println("Error code: " + sqlEx.getErrorCode());
sqlEx.printStackTrace();
sqlEx=sqlEx.getNextException();
}
}
}
}
出错信息:
SQLException information
Error msg: Unable to load T2 native library. Type 2 JDBC architecture is not ye
t supported by the IBM DB2 JDBC Universal Driver Architecture
SQLSTATE: null
Error code: -99999
com.ibm.db2.jcc.b.SQLException: Unable to load T2 native library. Type 2 JDBC a
rchitecture is not yet supported by the IBM DB2 JDBC Universal Driver Architectu
re
at com.ibm.db2.jcc.t2.T2Configuration.a(T2Configuration.java:62)
at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:39)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:261)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at test.main(test.java:13)
我把jcc换成net或者app后出错信息为:
Could not load JDBC driver
Exception: java.lang.ClassNotFoundException: com.ibm.db2.app.DB2Driver
java.lang.ClassNotFoundException: com.ibm.db2.app.DB2Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at test.main(test.java:12)