Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. public Connection connect() {
  2.         try {
  3.             Class.forName(jdbcDriver);
  4.             System.out.print("jdbc:mysql://" + host  + "/" + database + "  " + user + "  " + password);
  5.             connection = DriverManager.getConnection("jdbc:mysql://" + host  + "/" + database, user, password);
  6.             connected = true;
  7.             return connection;
  8.         } catch (ClassNotFoundException e) {
  9.             e.printStackTrace();
  10.             return null;
  11.         } catch (SQLException e) {
  12.             e.printStackTrace();
  13.             return null;
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement