Chapter 5 Migrating jConnect Applications


Sybase extensions

jConnect version 4.1 and later include the package com.sybase.jdbcx that contains all of the Sybase extensions to JDBC. In versions of jConnect previous to 4.1, these extensions were available in the com.sybase.jdbc and com.sybase.utils packages.

com.sybase.jdbcx provides a consistent interface across different versions of jConnect. All of the Sybase extensions are defined as Java interfaces, which allows the underlying implementations to change without affecting applications built using these interfaces.

When you develop new applications that use Sybase extensions, use com.sybase.jdbcx. The interfaces in this package allow you to upgrade applications to versions of jConnect that follow version 4.0 with minimal changes.

Note   Applications previously built using the Sybase extensions to the JDBC API, which were available in com.sybase.jdbc and com.sybase.utils, will continue to work under jConnect 4.x; however, all Sybase extensions in com.sybase.jdbc and com.sybase.utils have been marked deprecated.

Some of the Sybase extensions have been changed to accommodate the new com.sybase.jdbcx interface.

Change example

If an application uses the SybMessageHandler, the code differences would be:

Method names

The following table lists how methods were been renamed in the new interface.

Class Old name New name
SybConnection getCapture( ) createCapture( )
SybConnection setMessageHandler( ) setSybMessageHandler( )
SybConnection getMessageHandler( ) getSybMessageHandler( )
SybStatement setMessageHandler( ) setSybMessageHandler( )
SybStatement getMessageHandler( ) getSybMessageHandler( )

Debug class

Direct static references to the Debug class are no longer supported, but exist in deprecated form in the com.sybase.utils package. To use jConnect debugging facilities, use the getDebug( ) method of the SybDriver class to obtain a reference to the Debug class. For example:

import com.sybase.jdbcx.SybDriver;
import  com.sybase.jdbcx.Debug;
.
.
.
SybDriver  sybDriver =
		SybDriver)Class.forName
		("com.sybase.jdbc2.jdbc.SybDriver")  newInstance();
Debug sybDebug = sybDriver.getDebug();
sybDebug.debug(true,  "ALL", System.out);

A complete list of Sybase extensions is in the jConnect javadoc documentation located in the docs/ directory of your jConnect installation directory.

 


Copyright © 2001 Sybase, Inc. All rights reserved.