Advertisement
Guest User

Untitled

a guest
Dec 28th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.SQLException;
  4.  
  5. public class DBConnector {
  6.     private static final String HOST = "jdbc:mysql://localhost:3306/keypass?useUnicode=true&useSSL=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
  7.     private static final String USERNAME = "root";
  8.     private static final String PASSWORD = "13qe2w13";
  9.     private Connection connection;
  10.  
  11.     public Connection getConnection() {
  12.         return connection;
  13.     }
  14.  
  15.  
  16.  
  17.     public DBConnector() {
  18.         try {
  19.             connection = DriverManager.getConnection(HOST, USERNAME, PASSWORD);
  20.         }catch (SQLException e){
  21.             e.getMessage();
  22.         }
  23.  
  24.     }
  25.  
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement