Migrating jConnect Applications


Changing 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.

The com.sybase.jdbcx package provides a consistent interface across different versions of jConnect. All of the Sybase extensions are defined as Java interfaces, which allow 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.

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

Extension change example

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

Method names

Table 6-1 lists how methods have been renamed in the new interface.

Table 6-1: Method name changes
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.jdbc3.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 (C) 2005. Sybase Inc. All rights reserved.