Guest User

Untitled

a guest
Oct 29th, 2017
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1.     @Override
  2.     public Connection openConnection() throws SQLException, ClassNotFoundException {
  3.         if (checkConnection()) {
  4.             return connection;
  5.         }
  6.  
  7.         String connectionURL = "jdbc:mysql://" + this.hostname + ":" + this.port;
  8.         if (database != null) {
  9.             connectionURL = connectionURL + "/" + this.database;
  10.         }
  11.  
  12.         Class.forName("com.mysql.jdbc.Driver");
  13.         connection = DriverManager.getConnection(connectionURL, this.user, this.password);
  14.         return connection;
  15.     }
Add Comment
Please, Sign In to add comment