by Dinesh Thakur

The ResultSetMetaDa ta interface provides methods that allow you to get metadata for the resultset, that is, the number, types and properties of the columns in a ResultSet object. This information is used to collect the data with same semantics but stored in different databases in different formats.



 
by Dinesh Thakur

PreparedStatement interface extends the Statement interface so it has access to all the methods of Statement interface. It is used to execute precompiled parameterized SQL statements.

 
by Dinesh Thakur

The execution of SQL statement results in a table which consists of rows and columns containing the resultant data. The data can be retrieved from the table by using methods of the ResultSet interface. Some methods of the ResultSet interface are as follows.

 
by Dinesh Thakur

The statement interface provides methods that are used to execute static SQL statements. The SQL statements are queries, insertions, updates and deletions, etc.

 
by Dinesh Thakur

The Connection interface helps to establish a connection with the required database. Other than establishing connection, it provides lot of functionality including transaction management, maintaining database sessions and creating SQL statements.

 
by Dinesh Thakur

The DriverManager class is responsible for loading the driver specific classes. The drivers are registered with the DriverManager class either when an instance of driver is created using registerDriver (Driver driver) method of the DriverManager class or DriverManager class is initialized.

 
by Dinesh Thakur

Microsoft's ODBC is the most commonly used driver to connect to the database as it can connect to almost all databases on most of the platforms. However, ODBC uses the concept of pointers and other constructs that are not supported by Java.



 
by Dinesh Thakur

Data about data is called metadata. That means data about column names, data type names of database software etc. JDBC supported Metadata programming areas follows:



 
by Dinesh Thakur

ResultSet is an interface present in java.sql package and provided under JDBC core API. The java.sql. ResultSet interface is defined to describe an object called ResultSet object, implemented by third-party vendor as a part of JDBC driver.



 
by Dinesh Thakur

CallableStatement of JDBC is derived from interface of PreparedStatement. In JDBC, CallableStatement is best statement because by using this statement we can execute SQL operation on database and we can also call stored procedure of database. The only difference between CallableStatement and PreparedStatement is that the latter is not useful to call a stored procedure but it is possible through the former.



 
by Dinesh Thakur

To overcome the above limitation, use precompiled SQL query with the help of PreparedStatement object. The JDBC PreparedStatement object deals with precompiled SQL query. The query that comes to database software from Java application without values only once becomes parsed query in database software only once and allows client application(Java application) to set the values for query for the multiple times, with same or different values to gather the results for multiple times. This is called precompiled SQL query.



 
by Dinesh Thakur

The Statement object executes a normal SQL statement to update or query the database. The java.sql.Statement interface is a part of JDBC API that describes a standard abstraction for statement object which is implemented as part of JDBC driver.



 
by Dinesh Thakur

A JDBC statement object is used to execute an SQL statement. JDBC API supports three types of JDBC statement object to work with the SQL statements.



 
by Dinesh Thakur

The save point is a logical position in a transaction up to which we can rollback the transaction. When the save point is placed in the middle of the transaction, the logics placed before the save point will be committed and the logics placed after the save point will be rolled back. There are two types of save points:

 
by Dinesh Thakur

Join is a keyword in SQL that is used to retrieve data from two or more table based on some relationship between two columns.

 
by Dinesh Thakur

JDBC connection pool is divided into two parts:

1. JDBC Driver Managed/Stand Alone JDBC Connection Pool (Resides Outside The Server)

2. Web Server Managed JDBC Connection Pool



 
by Dinesh Thakur

Limitations of ResultSet object

 

Objects become serializable object only when its class implements java.io.5erializable

interface. We can send only Serializable objects over the network.

i. ResultSet object cannot be send over the network because it is not Serializable object.

ii. ResultSet object does not support beans style programming.



 
by Dinesh Thakur

Network round trips (query gone for execution to database and result comes to the screen, i.e., one network roundtrip) increases while sending multiple queries as individual queries to the database. It is recommended to combine them into a single unit/batch and send that batch to database only once for execution. This is called batch processing and this reduces network round trips between Java application and the database software.



 
by Dinesh Thakur

A transaction is a group of operations used to perform a particular task. In a transaction if one operation fails then all operations of the transaction gets cancelled. Finally, the transaction status fails.