HikariCP Connection Pooling Java Example

In this post we’ll see how to configure connection pooling using HikariCP in your JDBC application. Maven dependency for HikariCP If you are using Maven then you can add the following dependency in pom.xml which works for Java 8 to Java 11. <dependency> <groupId>com.zaxxer</groupId> <artifactId>HikariCP</artifactId> <version>3.4.5</version> </dependency> You can also…

Continue reading

C3P0 Connection Pooling Java Example

In this post we’ll see how to configure connection pooling in your application using C3P0. Maven dependency for MChange C3P0 If you are using Maven then you can add the following dependency in pom.xml <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.5.5</version> </dependency> You can also download the jars directly from the following location…

Continue reading

JDBC DataSource Interface

For a small application it is OK to use DriveManager to get connection as we saw in the example JDBC Database Connection Steps but any enterprise application will most definitely use DataSource as means of connecting to a data source. With JDBC DataSource objects you get advantage of connection pooling…

Continue reading

JDBC ResultSet Interface

java.sql.ResultSet interface represents the data you get by executing a database query. Once you get the ResultSet you can iterate it to go over the records. For facilitating iteration, ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row.…

Continue reading

JDBC CallableStatement Interface

In JDBC API there is a Statement interface that provides functionality to execute static SQL statements. Then there is PreparedStatement interface that extends Statement and adds functionality to create parameterized SQL statements. PreparedStatement is extended by CallableStatement in JDBC API and it provides functionality to execute SQL stored procedures. How…

Continue reading

JDBC Statement Interface

java.sql.Statement is used for executing a static SQL statement and returning the results it produces. Statement interface has two subinterfaces- PreparedStatement– Stores a precompiled SQL statement which can then be used to execute this statement multiple times by passing different values for the parameters. Read more about PreparedStatement in this…

Continue reading

JDBC Driver Interface

java.sql.Driver interface in JDBC API is one interface that every Driver class has to implement compulsorily. Each driver should supply a class that implements the Driver interface. When you load/register a driver by any of the following ways, Driver class implementation is loaded. After the class is loaded it creates…

Continue reading