JDBC 2.0 New Features : JDBC 2.0 API:
The java.sql package shipped with with JDK 2.0 is known as JDBC 2.0 API. It adds mainly four new features to JDBC 1.0 (shipped with JDK 1.0). All the earlier programs are illustrated with JDBC 1.0 style. Let us repeat the above programs with JDBC 2.0 and observe the difference.
JDBC 2.0 New Features : 4 given
- Scrollable ResultSet: The ResultSet records are scrollable. That is, the records can be printed from top to bottom or bottom to top or the cursor can be placed on any specific record. In JDBC 1.0, the records can be printed from top to bottom only. It is explained clearly in http://way2java.com/jdbc/jdbc-2-0/scrollable-resultset/ and program is available at Creating Scrollable ResultSet Example.
- Batch Updates: A number of update commands can be made into a batch. When the batch is executed, all the update commands execute at a time only. The advantage of batch update with example is explained in Batch Update Example.
- UpdateXXX() methods: Without knowing or writing SQL commands, using updateXXX() methods, a record can be inserted or deleted or updated. An example program is available at ResultSet Enhancement Update Methods Example.
- Using SQL3 data types as column values: SQL3 types are new datatypes that will be introduced in the coming version of ANSI SQL standard. JDBC 2.0 comes with interfaces to map SQL3 data types into Java program, in the simialar way you do with general data types.