Advertisement
Guest User

Untitled

a guest
Jul 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1.         public Connection openConnection() throws Exception {
  2.             Class.forName("com.mysql.jdbc.Driver");
  3.             try {
  4.                 return this.conn = DriverManager.getConnection("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database, this.user, this.password);
  5.             } catch (MySQLNonTransientConnectionException e) {
  6.                 System.out.println(this.database);
  7.                 e.printStackTrace();
  8.                 return null;
  9.             }      
  10.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement