forked from MagicBane/Server
Project cleanup pre merge.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 MagicBane Emulator Project
|
||||
* All Rights Reserved
|
||||
* All Rights Reserved
|
||||
*/
|
||||
package engine.pooling;
|
||||
|
||||
@@ -12,44 +12,44 @@ import java.sql.SQLException;
|
||||
|
||||
public class ConnectionPool extends LinkedObjectPool<Connection> {
|
||||
|
||||
static {
|
||||
//Register the Driver
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
|
||||
} catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
static {
|
||||
//Register the Driver
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
|
||||
} catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public ConnectionPool() {
|
||||
super(10);
|
||||
}
|
||||
public ConnectionPool() {
|
||||
super(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Connection makeNewObject() {
|
||||
// Protocol
|
||||
String sqlURI = "jdbc:mysql://";
|
||||
sqlURI += ConfigManager.MB_DATABASE_ADDRESS.getValue() + ':' + ConfigManager.MB_DATABASE_PORT.getValue();
|
||||
sqlURI += '/' + ConfigManager.MB_DATABASE_NAME.getValue() + '?';
|
||||
sqlURI += "useServerPrepStmts=true";
|
||||
sqlURI += "&cachePrepStmts=false";
|
||||
sqlURI += "&cacheCallableStmts=true";
|
||||
sqlURI += "&characterEncoding=utf8";
|
||||
@Override
|
||||
protected Connection makeNewObject() {
|
||||
// Protocol
|
||||
String sqlURI = "jdbc:mysql://";
|
||||
sqlURI += ConfigManager.MB_DATABASE_ADDRESS.getValue() + ':' + ConfigManager.MB_DATABASE_PORT.getValue();
|
||||
sqlURI += '/' + ConfigManager.MB_DATABASE_NAME.getValue() + '?';
|
||||
sqlURI += "useServerPrepStmts=true";
|
||||
sqlURI += "&cachePrepStmts=false";
|
||||
sqlURI += "&cacheCallableStmts=true";
|
||||
sqlURI += "&characterEncoding=utf8";
|
||||
|
||||
Connection out = null;
|
||||
try {
|
||||
out = DriverManager.getConnection(sqlURI, ConfigManager.MB_DATABASE_USER.getValue(),
|
||||
ConfigManager.MB_DATABASE_PASS.getValue());
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Connection out = null;
|
||||
try {
|
||||
out = DriverManager.getConnection(sqlURI, ConfigManager.MB_DATABASE_USER.getValue(),
|
||||
ConfigManager.MB_DATABASE_PASS.getValue());
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resetObject(Connection obj) {
|
||||
@Override
|
||||
protected void resetObject(Connection obj) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user