Setting up jConnect  JCONNECT_VERSION connection property

Chapter 2: Programming Information

Setting the jConnect version

There are several versions of jConnect; use a version setting to determine:

Table 2-1 lists the version settings available and their features.

Table 2-1: jConnect version settings and their features

Version constant

Features

Comments

VERSION_6

  • jConnect requests support for the date and time SQL datatypes from the server. This request is ignored by servers other than Adaptive Server version 12.5.1 and later.

  • jConnect requests support for the unichar and univarchar datatypes from the server. This request is ignored by servers other than Adaptive Server 12.5 and later.

  • jConnect requests support for wide tables from the server. This request is ignored by servers other than Adaptive Server 12.5 and later.

  • The default value of the LANGUAGE connection property is null.

  • If the CHARSET connection property does not specify a character set, jConnect uses the database’s default character set.The default value for CHARSET_CONVERTER is the PureConverter class.

  • By default, Statement.cancel( ) cancels only the Statement object it is invoked on.

  • JDBC 2.0 methods can be used to store and retrieve Java objects as column data.

For jConnect version 5.x, the default is VERSION_5.

For additional information, see the comments for VERSION_4.

For additional information for date and time datatypes, see “Using Date and Time datatypes”.

For more information on wide tables, see “Wide table support for Adaptive Server version 12.5 and later”.

For more information on unichar and univarchar datatypes and Unicode, see “Using jConnect to pass Unicode data”.

VERSION_5

  • The default value of the LANGUAGE connection property is null.

  • If the CHARSET connection property does not specify a character set, jConnect uses the database’s default character set.The default value for CHARSET_CONVERTER is the PureConverter class.

  • By default, Statement.cancel( ) cancels only the Statement object it is invoked on.

  • JDBC 2.0 methods can be used to store and retrieve Java objects as column data.

For jConnect version 5.x, the default is VERSION_5.

For additional information, see the comments for VERSION_4.

VERSION_4

  • The default value of the LANGUAGE connection property is null.

  • If the CHARSET connection property does not specify a character set, jConnect uses the database’s default character set.The default value for CHARSET_CONVERTER is the PureConverter class.

  • By default, Statement.cancel( ) cancels only the Statement object it is invoked on.

  • JDBC 2.0 methods can be used to store and retrieve Java objects as column data.

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

  • The default value of the LANGUAGE connection property is us_english.

  • If the CHARSET connection property does not specify a character set, jConnect uses the database’s default character set.

  • The default value for CHARSET_CONVERTER is the PureConverter class.

  • By default, Statement.cancel( ) cancels the object it is invoked on and any other Statement objects that have begun to execute and are waiting for results.

See the comments for VERSION_2.

VERSION_2

  • The default value of the LANGUAGE connection property is us_english.

  • If the CHARSET connection property does not specify a character set, the default character set is iso_1.

  • The default value for CHARSET_CONVERTER is the TruncationConverter class, unless the CHARSET connection property specifies a multibyte or 8-bit character set, in which case the default CHARSET_CONVERTER is the PureConverter class.

  • By default, Statement.cancel( ) cancels the object it is invoked on and any other Statement objects that have begun to execute and are waiting for results.

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_5

Use SybDriver.setVersion( ) to set the jConnect version. The setVersion method will affect 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 samples show how to load the jConnect driver and set the version:

import com.sybase.jdbcx.SybDriver;
SybDriver sybDriver = (SybDriver)
   Class.forName   ("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
sybDriver.setVersion
   (com.sybase.jdbcx.SybDriver.VERSION_5);
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're using. However, by setting the version to VERSION_LATEST, you may see behavior changes, if you replace your 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.

For wide table, unichar, and date/time datatype support with jConnect 5.5:

To enable wide table, unichar, and date/time datatype support with Adaptive Server version 12.5 and later, (date/time datatype support is only available in Adaptive Server version 12.5.1 and later), use SybDriver.setVersion( ) to set the jConnect version to 6:

sybDriver.setVersion
   (com.sybase.jdbcx.SybDriver.VERSION_6);




Copyright © 2003. Sybase Inc. All rights reserved. JCONNECT_VERSION connection property

View this book as PDF