BoneCP connection pool example

By | August 5, 2018

In Previous few Posts We had learnt about following Database Connection Pools:
MysqlDataSource example
DBCP Connection Pooling Example
C3P0 JDBC connection pool Example

In this post we will learn how to establish Jdbc connection pool using BoneCP

Note:You have to add few dependencies binaries in your project class path those dependencies you can see in the blow project lib folder 

Project structure in eclipse:

Create database.properties file in src folder as shown in the above project structure and make entry of below properties.

SQL Query to create employee_table in MySQL (jdbcpooldb schema) 

Once you execute above db script your database schema(jdbcpooldb) will be created and employee_table will be created with three rows as below.  

Utility class which is responsible to get JDBC connection object using  BoneCP DataSource connection pool With MYSQL Database.

This Client class makes use of DBUtil.getDataSource() method to take connection from  BoneCP connection pool With MYSQL Database. 

After running ClientTest.java program you will look below  output on eclipse console: 

Above eclipse console output shows we are able to read rows from MySQL database that means we are successfully taken database connection using BoneCP connection pool

That’s all about  this topic BoneCP connection pool example.
If you have any feedback or suggestion please feel free to drop in blow comment box.

4 thoughts on “BoneCP connection pool example

Leave a Reply

Your email address will not be published. Required fields are marked *