Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1.     public Connection getSQLConnection() {
  2.         try {
  3.             if (sql_connection == null || sql_connection.isClosed()) {
  4.                 Class.forName("com.mysql.jdbc.Driver");
  5.                 String url = "jdbc:mysql://" + sql.get(0) + ":" + sql.get(1) + "/" + sql.get(2);
  6.                 sql_connection = DriverManager.getConnection(url, sql.get(3), sql.get(4));
  7.             }
  8.         } catch (ClassNotFoundException | SQLException e) {
  9.             this.getLogger().log(Level.SEVERE, null, e);
  10.         }
  11.  
  12.         return sql_connection;
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement