Home » Core Java » apache » commons » dbcp » BasicDatasource


org.apache.commons.dbcp.BasicDataSource Example

In this example, we shall show you how to use BasicDataSource of Apache commons dbcp library. DBCP is a part of apache common components and intended for database connection pooling. BasicDataSource is a basic implementation of javax.sql.DataSource Using BasicDataSource, one can easily connect to a Relational Database as we will show in following example. For this example, we will be using ...

Read More »

Create a simple BasicDataSource object

With this example we are going to demonstrate how to create a simple org.apache.commons.dbcp.BasicDataSource object, that is the basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. In short, to create a simple BasicDataSource object you should: Create a BasicDataSource object and configure the database. Use setDriverClassName(String driverClassName) method to set the jdbc driver class name. Use setUrl(String url) method ...

Read More »