Package com.angelini.fly

Source Code of com.angelini.fly.FlyDB

package com.angelini.fly;

import java.beans.PropertyVetoException;
import java.sql.Connection;
import java.sql.SQLException;

import com.jolbox.bonecp.BoneCP;
import com.jolbox.bonecp.BoneCPConfig;

public class FlyDB {
 
  private BoneCP pool;
 
  public FlyDB(String jdbc, String user, String pass) throws SQLException, PropertyVetoException, Exception {
    Class.forName("java.sql.Driver");
   
    BoneCPConfig config = new BoneCPConfig();
      config.setJdbcUrl(jdbc);
      config.setUsername(user);
      config.setPassword(pass);
     
      config.setMinConnectionsPerPartition(5);
    config.setMaxConnectionsPerPartition(20);
    config.setPartitionCount(1);
     
      pool = new BoneCP(config);
  }
 
  public Connection getConn() throws SQLException {
    return pool.getConnection();
  }
 
}
TOP

Related Classes of com.angelini.fly.FlyDB

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.