There are several versions of jConnect. Use a version setting to determine:
The default value of the LANGUAGE connection property
The version-specific features that are available
The default character set, if no character set is specified through the CHARSET connection property
The default value of the CHARSET_CONVERTER connection property
The default value of the CANCEL_ALL connection property, which is used to set the behavior of Statement.cancel, which by default cancels the object on which it is invoked and any other Statement objects that have begun to execute and are waiting for results
If you are requesting support for wide tables from the server
If you would like to request server support for storing character data in unichar (Unicode) columns
Only Adaptive Server version 12.5 and later support
wide tables and unichar character data.
If you would like to request support from the server for the date and time SQL datatypes
Only Adaptive Server version 12.5.1 and later support
the date and time SQL
datatypes.
Table 2-1 lists the version settings available and their features.
Version constant |
Features |
Comments |
---|---|---|
VERSION_6 |
|
For jConnect version 6.0, the default is VERSION_6. For additional information for date and time datatypes, see “Using date and time datatypes”. For more information on unichar and univarchar datatypes and Unicode, see “Using jConnect to pass Unicode data”. For more information on wide tables, see “Using wide table support for Adaptive Server version 12.5 and later”. |
VERSION_5 |
|
For jConnect versions 5.x, the default is VERSION_5. |
VERSION_4 |
|
Server messages are localized according to the language setting in your local environment. The languages supported are Chinese, U.S. English, French, German, Japanese, Korean, Polish, Portuguese, and Spanish. The default behavior of Statement.cancel is JDBC-compliant. Use CANCEL_ALL to set the behavior of Statement.cancel. See “CANCEL_ALL connection property”. For information on Java objects as column data, see “Storing Java objects as column data in a table”. |
VERSION_3 |
|
See the comments for VERSION_2. |
VERSION_2 |
|
The LANGUAGE connection property determines the language in which messages from jConnect and the server appear. For information on the CHARSET and CHARSET_CONVERTER connection classes, see “jConnect character-set converters”. The VERSION_2 default behavior of Statement.cancel is not JDBC-compliant. Use CANCEL_ALL to set the behavior of Statement.cancel. See “CANCEL_ALL connection property”. |
The version values are constant values from the SybDriver class. When referring to the version constant, use this syntax:
com.sybase.jdbcx.SybDriver.VERSION_6
Use SybDriver.setVersion to set the jConnect version. The setVersion method affects the jConnect default behavior for all connections created by the SybDriver object. However, you can use the JCONNECT_VERSION connection property to set version-specific behavior for individual connections. The following code sample shows how to load the jConnect driver and set the version:
import com.sybase.jdbcx.SybDriver; SybDriver sybDriver = (SybDriver) Class.forName ("com.sybase.jdbc3.jdbc.SybDriver").newInstance(); sybDriver.setVersion (com.sybase.jdbcx.SybDriver.VERSION_6); DriverManager.registerDriver(sybDriver);
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 was made. Changing the version setting during a session does not affect the current connection. jConnect provides a com.sybase.jdbcx.SybDriver.VERSION_LATEST constant which can be used 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.
As described in the next section, you can use JCONNECT_VERSION to override the SybDriver version setting and specify a different version setting for a specific connection.