You may handle SQL errors and warnings in the following way:

Java Code:
       dbConn = DriverManager.getConnection
          ("jdbc:odbc:YourDatabaseName","username","password");
       SQLWarning w = dbConn.getWarnings();
       // If a SQLWarning object was returned by the
       // Connection object, the warning messages are displayed.
       // You may have multiple warnings chained together
       if (w != null) {
         System.out.println ("\n *** SQL Warning ***\n");
         while (w != null) {
           System.out.println ("Message:  " + w.getMessage ());
           System.out.println ("SQLState: " + w.getSQLState ());
           System.out.println ("VendorCode:   " + w.getErrorCode ());
           System.out.println ("");
           w = w.getNextWarning ();
           }
         }