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

JDBC Connection Interface

Using Java Connection interface you can create a session with a specific database. SQL statements are executed and results are returned within the context of a connection. Connection interface in JDBC API resides in java.sql package. How to get Connection instance You can create Connection object using DriverManager.getConnection() method. Connection…

Continue reading

JDBC DriverManager Class

java.sql.DriverManager class in JDBC API in Java is a utility class to manage a set of JDBC drivers. Before connection to DB and start any DB operation you will have to register the driver for that specific DB with the DriverManager class. Java DriverManager class methods Main task of the…

Continue reading

JDBC Driver Types

JDBC API in Java programming language provides a standard, universal way to connect to databases. It is the responsibility of different DB vendors to provide the implementation of the interfaces in JDBC API and that implementation by DB vendors is provided as JDBC drivers. Table of contents Types of JDBC…

Continue reading