1. static void connect () {
  2. try {
  3. Class.forName ("org.gjt.mm.mysql.Driver");
  4. conn = DriverManager.getConnection (
  5. "jdbc:mysql://localhost:3306/mysql");
  6. }
  7. catch (SQLException sqle) {
  8. System.out.println ("SQL exception:" + sqle.getMessage ());
  9. System.out.println ("SQLState:" + sqle.getSQLState ());
  10. System.out.println ("VendorError:" + sqle.getErrorCode ());
  11. System.exit (-1);
  12. }
  13. catch (Exception sqle) {sqle.printStackTrace ();}
  14. }