BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Easier Database Development with JDBC 4.0

Easier Database Development with JDBC 4.0

Java 6.0 will include a number of Java Database Connectivity enhancements collectively known as JDBC 4.0. One of the main goals of JDBC 4.0 was to try and reduce the amount of boilerplate JDBC code a developer had to write. With this in mind a number of enhancements were made including:

  • Auto-loading of JDBC driver class
  • Connection management enhancements
  • Support for RowId SQL type
  • DataSet implementation of SQL using Annotations
  • SQL exception handling enhancements
  • SQL XML support

The DriverManager class can now lookup the appropriate database driver using the Java SE Service Provider included in Java 6.0. Class.forName() is no longer needed. The SQLException class has also been enhanced to support nested cause exceptions, next exceptions (when two SQLExceptions may be thrown at a time), and foreach support for iterating over exceptions. Blogger Patrick Lightbody noted "I could see JDBC 4.0 replacing my need for iBatis" after reading another blog post on JDBC 4.0 functionality. JDBC 4.0 includes basic O/R mapper functionality that eases the repetitive task of copying ResultSet data into objects. It does not handle inheritance or table relations however.

Rate this Article

Adoption
Style

BT