try {
// Code that could generate an exception goes here.
// If an exception is generated, the catch block below
// will print out information about it.
} catch(SQLException ex) {
System.out.println("\n--- SQLException caught ---\n");
while (ex != null) {
System.out.println("Message: "+ ex.getMessage ());
System.out.println("SQLState: "+ ex.getSQLState ());
System.out.println("ErrorCode: "+ ex.getErrorCode ());//这就是得到sql2000错误码的地方。
ex = ex.getNextException();
System.out.println("");
}
}