Migrating jConnect Applications
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.
If an application uses the SybMessageHandler, the code differences would be:
import com.sybase.jdbc.SybConnection; import com.sybase.jdbc.SybMessageHandler; . . Connection con = DriverManager.getConnection(url, props); SybConnection sybCon = (SybConnection) con; sybCon.setMessageHandler(new ConnectionMsgHandler());
import com.sybase.jdbcx.SybConnection; import com.sybase.jdbcx.SybMessageHandler; . . Connection con = DriverManager.getConnection(url, props); SybConnection sybCon = (SybConnection) con; sybCon.setSybMessageHandler(new ConnectionMsgHandler());
Table 6-1 lists how methods have 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( ) |
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. |
| |