JDBC ResultSetMetaData Interface

Using java.sql.ResultSetMetaData interface you can get metadata about the ResultSet object. When you retrieve data from DB a ResultSet object is returned with each ResultSet object there is an associated ResultSetMetaData object containing information about the returned ResultSet like table name, column count, column’s data type. How to get ResultSetMetaData…

Continue reading

JDBC DatabaseMetaData Interface

Using java.sql.DatabaseMetaData interface you can get metadata about the DB you are connected to. DatabaseMetaData interface in Java has methods to get information about- Database like DB Product name and version, scehemas available in DB. JDBC Driver like the driver’s name and version Tables in any DB schema, Views in…

Continue reading

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