What's New in the JDBC Driver
The following sections discuss new features in the Microsoft SQL Server JDBC Driver version 2.0.
What's New in the JDBC Driver Version 2.0
This version 2.0 release of the Microsoft SQL Server JDBC Driver includes several new features and enhancements.
Driver Name
The name of the JDBC driver no longer contains the version identifier of the SQL Server. As a result, the latest version of the JDBC driver is Microsoft SQL Server JDBC Driver version 2.0.
JDBC 4.0 Support
The JDBC driver version 2.0 now provides support for JDBC 4.0 API, which includes the following new features.
National Character Set API Support
The JDBC driver version 2.0 now includes new national character set conversion API methods. This support includes new setter, getter, and updater methods for NCHAR, NVARCHAR, LONGNVARCHAR, and NCLOB JDBC types. For more information, see National Character Set Support.
SQLXML Support
The JDBC Driver version 2.0 now provides support for the SQLXML data type. For more information on using SQLXML, see Supporting XML Data.
SQLServerConnection createBlob, createClob, and createNClob Methods
The JDBC driver version 2.0 now enhances the SQLServerConnection class by providing support for the creation of BLOB, CLOB, and NCLOB objects. For more information, see the createBlob, createClob and createNClob methods.
java.sql.Wrapper Interface
The JDBC driver version 2.0 supports the java.sql.Wrapper interface. This interface provides a mechanism to access extensions to the JDBC API that are specific to the Microsoft SQL Server JDBC Driver through a proxy interface.
The java.sql.Wrapper interface defines two methods: isWrapperFor and unwrap. The isWrapperFor method checks whether the specified input object implements this interface. The unwrap method returns an object that implements this interface to allow access to the Microsoft SQL Server JDBC Driver specific methods.
Other New JDBC 4.0 API Methods
The JDBC Driver version 2.0 now provides support for the following JDBC 4.0 methods:
SQLServerConnection: isValid, getClientInfo, and setClientInfo.
SQlServerDatabaseMetadata: autoCommitFailureClosesAllResultSets, getClientInfoProperties, getFunctionColumns, getFunctions, getRowIdLifetime, getSchemas, and supportsStoredFunctionsUsingCallSyntax.
SQLServerStatement: isClosed method.
SQLServerCallableStatement: Overloaded setAsciiStream, setBinaryStream, setCharacterStream, setBlob, setClob methods, and getCharacterStream method.
SQLServerPreparedStatement: Overloaded setAsciiStream, setBinaryStream, setCharacterStream, setBlob, and setClob methods.
SQLServerResultSet: isClosed, getHoldability, overloaded updateAsciiStream, updateBinaryStream, updateBlob, updateCharacterStream, and updateClob methods.
JDBC 3.0 Jar and JDBC 4.0 Jar
The JDBC Driver version 2.0 provides two class library files, sqljdbc.jar and sqljdbc4.jar, to be used depending on your preferred Java Runtime Environment (JRE) settings.
sqljdbc.jar class library provides support for JDBC 3.0 and requires a Java Runtime Environment (JRE) of version 5.0. sqljdbc4.jar class library provides support for JDBC 4.0 and requires a Java Runtime Environment (JRE) of version 6.0 or later. sqljdbc4.jar includes all of the features of the sqljdbc.jar as well as the new JDBC 4.0 methods. For more information about which JAR file to choose, see System Requirements for the JDBC Driver.
Important
The JDBC Driver version 2.0 does not support JRE 1.4.
sendStringParametersAsUnicode Connection Property
For optimal performance with the CHAR, VARCHAR, and LONGVARCHAR JDBC data types, an application using the version 2.0 of the JDBC driver should set the sendStringParametersAsUnicode connection property to "false" and use non-national character methods. For more information about the sendStringParametersAsUnicode connection property, see Setting the Connection Properties.
loginTimeout Connection Property
Starting with JDBC driver version 2.0, the default value of loginTimeout connection property is 15 seconds. In the version 1.2 release, the default value was 0. For more information about the loginTimeout connection property, see Setting the Connection Properties.
Enhanced Tracing Driver Operation
This version of the JDBC Driver enhances tracing the driver operation by logging public methods’ entry and exit points and providing better distinction between the trace levels. For more information, see Tracing Driver Operation.
Default Behavior of Adaptive Buffering
Starting with JDBC driver version 2.0, the default response buffering behavior of the driver is "adaptive." This means that in order to get the adaptive buffering behavior, your application does not have to request the adaptive behavior explicitly. In the version 1.2 release, the buffering mode was "full" by default and the application had to request the adaptive buffering mode explicitly. If you want to keep the version 1.2 default behavior in your application, you must set the responseBufferring connection propery to "full". For more information about adaptive buffering, see Using Adaptive Buffering.
Collation Support
In JDBC Driver version 2.0, the driver supports all the collations supported by SQL Server 2000, SQL Server 2005, and the new collations or new versions of Windows collation names introduced in SQL Server 2008. For more information, see International Features of the JDBC Driver.