Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void mysqlSetup() {
- host = configmmysql.getConfig().getString("host");
- port = configmmysql.getConfig().getInt("port");
- database = configmmysql.getConfig().getString("database");
- username = configmmysql.getConfig().getString("username");
- password = configmmysql.getConfig().getString("password");
- table = configmmysql.getConfig().getString("table");
- try {
- synchronized (this) {
- if (getConnection() != null && !getConnection().isClosed()) {
- return;
- }
- Class.forName("com.mysql.jdbc.Driver");
- setConnection(DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database,
- username, password));
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- }
Add Comment
Please, Sign In to add comment