The jConnect version property JCONNECT_VERSION determines the driver’s behavior and the features activated. For example, Adaptive Server 15.5 supports both jConnect 6.05 and 7.0, however, these two versions differ in their handling of datetime and time data. When connecting to Adaptive Server 15.5, jConnect 7.0, which supports microsecond granularity for time data, uses bigdatetime or bigtime even if the target Adaptive Server columns are defined as datetime or time. jConnect 6.05, however, does not support microsecond granularity and always transfers datetime or time data when connecting to Adaptive Server 15.5.
You can set the jConnect version by using either the SybDriver.setVersion method or the JCONNECT_VERSION connection property.
The setVersion method affects the jConnect default behavior for all connections created by the SybDriver object. You can call setVersion multiple times to change the version setting. New connections inherit the behavior associated with the version setting at the time the connection is made. Changing the version setting during a session does not affect current connections. You can use the com.sybase.jdbcx.SybDriver.VERSION_LATEST constant to ensure that you are always requesting the highest version value possible for the jConnect driver you are using. However, by setting the version to com.sybase.jdbcx.SybDriver.VERSION_LATEST, you may see behavior changes if you replace your current jConnect driver with a newer one.
This code sample shows how to load the jConnect driver and set its version:
import java.sql.DriverManager; import com.sybase.jdbcx.SybDriver; SybDriver sybDriver = (SybDriver) Class.forName("com.sybase.jdbc4.jdbc.SybDriver") .newInstance(); sybDriver.setVersion(com.sybase.jdbcx.SybDriver. VERSION_7); DriverManager.registerDriver(sybDriver);
You can use the JCONNECT_VERSION connection property to override the SybDriver version setting and specify a different version setting for a specific connection. Table 2-1 lists the valid JCONNECT_VERSION values and the jConnect characteristics associated with these values.
JCONNECT_VERSION |
Features |
---|---|
“7.0” |
jConnect 7.0 behaves in the same way as jConnect 6.05, except that in this version:
|
“6.05” |
jConnect 6.05 behaves in the same way as jConnect 6.0, except that in this version:
|
“6” |
jConnect 6.0 behaves in the same way as jConnect 5.x, except that in this version:
|
“5” |
jConnect 5.x behaves in the same way as jConnect 4.0. |
“4” |
jConnect 4.0 behaves in the same way as jConnect 3.0, except that in this version:
|
“3” |
jConnect 3.0 behaves in the same way as jConnect 2.0, except that in this version:
|
“2” |
|