private BoneCP connectionPool = null;
public void init(IStoreConfig configInterface) throws ConfigBite
{
if(!(configInterface instanceof JdbcConfig))
throw new ConfigBite("Configuration instance is not a JdbcConfig");
config = (JdbcConfig) configInterface;
try
{
Class.forName(config.getDriverClassName());
}
catch (ClassNotFoundException e)
{
throw new ConfigBite("Driver not found", e);
}
BoneCPConfig bcpConfig = new BoneCPConfig();
bcpConfig.setJdbcUrl(config.getConnectionString());
bcpConfig.setUsername(config.getUsername());
bcpConfig.setPassword(config.getPassword());
bcpConfig.setMinConnectionsPerPartition(5);
bcpConfig.setMaxConnectionsPerPartition(10);
bcpConfig.setPartitionCount(1);
try
{
connectionPool = new BoneCP(bcpConfig);
}
catch (SQLException e)
{
throw new ConfigBite("Could not create the ConnectionPool");
}
}