Skip to content

Instantly share code, notes, and snippets.

@akandratovich
Created July 19, 2013 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akandratovich/6037925 to your computer and use it in GitHub Desktop.
Save akandratovich/6037925 to your computer and use it in GitHub Desktop.
driverClass=com.mysql.jdbc.Driver
jdbcUrl=jdbc:mysql://192.168.222.3:13306/channelplace20130227?autoReconnect=true&characterEncoding=utf-8&useUnicode=true
username=social
password=social
partitionCount=4
maxConnectionsPerPartition=8
minConnectionsPerPartition=2
acquireIncrement=1
...
private static BoneCPDataSource initialize() {
PropertyResourceBundle config = (PropertyResourceBundle) ResourceBundle.getBundle("bonecp");
Properties p = new Properties();
Enumeration<String> keys = config.getKeys();
while (keys.hasMoreElements()) {
String key = keys.nextElement();
p.setProperty(key, config.getString(key));
}
BoneCPDataSource ds = new BoneCPDataSource();
try {
Class.forName("com.mysql.jdbc.Driver");
ds.setProperties(p);
ds.setDriverProperties(p);
ds.sanitize();
} catch (Exception e) {
logger.error("Could not initialize datasource", e);
}
return ds;
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment