Home Tutorial Java Jdbc Jdbcexamples What's new in JDBC 3.0?

 
 

What's new in JDBC 3.0?
Posted on: April 3, 2006 at 12:00 AM
Advertisement
The Java Database Connectivity (JDBC) API has been a key part of the J2EE and J2SE platforms. Learn new features of JDBC 3.0.

What's new in JDBC 3.0?

In this section we will learn about the new features of JDBC 3.0. The new version of JDBC 3.0 is released with many new features and a number of new functionalities. This section explains the news functionalities added to the JDBC 3.0.

New Features of JDBC 3.0

Metadata APIs

The Metadata API is updated in the version of JDBC. The DatabaseMetaData interface is now able to retrieve SQL type hierarchies. A new interface ParameterMetaData is added which describes the types and properties of the parameters in PreparedStatement objects.

Named parameters in CallableStatements

The CallableStatement is used for calling the store procedures. The CallableStatement interface has been updated to add the support for Named parameters. Now we can specify parameters by their names.

Data types changes

In this version of JDBC, several changes in the data types support are added. The two new data types java.sql.Types.DATALINK and java.sql.Types.BOOLEAN are added.

Features to retrieve auto-generated keys added

Now new feature is added that will allow the developers to retrieve the primary key generated by the database. Following code shows how to get the generated primary key:

    Statement stmt = conn.createStatement();
    stmt.executeUpdate("INSERT INTO article" + "(topic, conent) " +
           "VALUES ('What is Java?', 'Java is programming lanuage')",
           Statement.RETURN_GENERATED_KEYS);
           ResultSet rs = stmt.getGeneratedKeys();
          if ( rs.next() ) {
         // Retrieve the auto generated key(s).
         int key = rs.getInt(1);
    }

ResultSet holdability

JDBC 3.0 adds support for specifying cursor holdability.

Returning multiple results

Now in JDBC 3.0 specification the Statement interface can support multiple open ResultSets.

Connection pooling

The connection pooling support is also added.

Read more JDBC 3.0 features.

Advertisement

Related Tags for What's new in JDBC 3.0?:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 3, 2006

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com