Major Changes of the JDBC API 4.0

New JDBC Data Types

  • NVarchar, NChar (Unicode Strings)
  • NClob
  • SQLXML
  • RowID

New set/get Methods for Unicode Strings

VARCHAR and NVARCHAR can now be used together with the same Connection. Before it was necessary to choose only one of the data types on creation of a Connection (JDBC URL parameter).

 

Default Implementation for new BLOB, CLOB, NCLOB und SQLXML

Before it was necessary to implement the interface manually if you wanted to create one of these data types. The new instances can be filled with data and then used with the corresponding set method of PreparedStatement.

 

Unwrapping

With the methods unwrap() and isWrapperFor() you can access the native Connection, Statement, ResultSet, and other objects, if the Connections were created from a ConnectionPool.

 

Categorized SQLExceptions

For every error category there now exists a corresponding SQLException class. This makes it easer to implement specific error handling, for example with a list of vendor codes or a list of SQLStates. You can write a seprate catch branch for the different error categories.

  • SQLException
    • SQLNonTransientException
      • SQLDataException
      • SQLIntegrityConstraintViolationException
      • SQLInvalidAuthorizationSpecException
      • SQLNonTransientConnectionException
      • SQLSyntaxErrorException
    • SQLTransientException
      • SQLTimeoutException
      • SQLTransactionRollbackException
      • SQLTransientConnectionException

 

For more information, see:

 

© Copyright 1996 - 2024, i-net software; All Rights Reserved.