Advertisement
Guest User

Untitled

a guest
Feb 27th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1.         host = "localhost";
  2.         port = 3306;
  3.         database = "lemnos";
  4.         username = "root";
  5.         password = "";
  6.         table = "playerData";
  7.        
  8.         try {
  9.             synchronized(this)
  10.             {
  11.                 if(getMainConnection() != null && !getMainConnection().isClosed()) {
  12.                     return;
  13.                 }
  14.                
  15.                 try
  16.                 {
  17.                     Class.forName("com.mysql.jdbc.Driver");
  18.                 }
  19.                 catch (ClassNotFoundException f)
  20.                 {
  21.                     f.printStackTrace();
  22.                 }
  23.                
  24.                 this.setConnection(DriverManager.getConnection("jdbc:mysql://" +this.host+ ":" +this.port+ "/" +this.database+ "?useSSL=false", this.username, this.password));
  25.                
  26.                 System.out.println("######## MySQL connecté ########");
  27.             }
  28.         }
  29.         catch(SQLException f)
  30.         {
  31.             f.printStackTrace();
  32.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement