bonecp.url=jdbc:mysql://localhost:3306/mydatabase bonecp.username=root bonecp.password=123456 bonecp.partitionCount=2 bonecp.maxConnectionsPerPartition=10 bonecp.minConnectionsPerPartition=5 bonecp.acquireIncrement=3 bonecp.statementsCacheSize=100 import com.jolbox.bonecp.BoneCP; import com.jolbox.bonecp.BoneCPConfig; BoneCPConfig config = new BoneCPConfig(); config.setJdbcUrl("jdbc:mysql://localhost:3306/mydatabase"); config.setUsername("root"); config.setPassword("123456"); config.setPartitionCount(2); config.setMaxConnectionsPerPartition(10); config.setMinConnectionsPerPartition(5); config.setAcquireIncrement(3); config.setStatementsCacheSize(100); BoneCP connectionPool = new BoneCP(config); Connection connection = connectionPool.getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery("SELECT * FROM mytable"); resultSet.close(); statement.close(); connection.close();


上一篇:
下一篇:
切换中文