Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void sql_setup(String name)
- {
- host = configcfg.getString("sql." + name.toLowerCase() + ".host");
- port = configcfg.getInt("sql." + name.toLowerCase() + ".port");
- database = configcfg.getString("sql." + name.toLowerCase() + ".database");
- username = configcfg.getString("sql." + name.toLowerCase() + ".username");
- password = configcfg.getString("sql." + name.toLowerCase() + ".password");
- try
- {
- synchronized (this)
- {
- if (getConnection() != null && getConnection().isClosed())
- {
- return;
- }
- Class.forName("com.mysql.jdbc.Driver");
- setConnection(DriverManager.getConnection("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database, this.username, this.password));
- _Server.log("SQL" + name .toUpperCase() + " - Added Successfully");
- }
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
- catch (ClassNotFoundException e)
- {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement