com.sybase.jdbcx
Interface SybDriver


public abstract interface SybDriver
extends Driver

Sybase implementation of the Driver interface. It recognizes URLs of the form:

jdbc:sybase:<protocol>:<...>

If the URL is not of this form it will return a null connection. If this is the case, and SybDriver is the only driver loaded, DriverManager.getConnection will throw a NoSuitableDriverException.

The driver will raise a SQLException if the URL is of the correct form but the driver is unable to connect to the database.

The java.util.Properties argument can be used to pass arbitrary string tag/value pairs as connection arguments. Normally, at least "user" and "password" properties should be included in the properties.

Driver objects obtained from jConnect can be cast to this class to access Sybase-specific methods.

There are two ways to set the driver connection properties:

Driver connection properties set in the URL do not override any corresponding connection properties set in the application using the DriverManager.getConnection method. To obtain a current list of properties for any driver, use Driver.getDriverProperties.

The driver connection property names are not case-sensitive. jConnect uses prop.equalsIgnoreCase to remove case-sensitivity on property names.

Driver constructors are never called, rather a single instance of a driver is statically created when its class is loaded and that instance is installed in the static DriverManager. This static driver instance serves as a Connection factory. Drivers are never destroyed.

See Also:
Driver, java.sql.DriverManager

Field Summary
static int VERSION_2
          Version 2.x.
static int VERSION_3
          Version 3.x.
static int VERSION_4
          Versions 4.0, 4.1 and 4.2.
static int VERSION_5
          Versions 5.0 and 5.2 Same behavior as versions 4.0, 4.1 and 4.2.
static int VERSION_6
          Versions 4.5 and 5.5 Versions 4.5 and 5.5 allow the user to request XNL widetable support from the server.
static int VERSION_LATEST
          Instructs the driver to behave as the latest version.
 
Method Summary
 DynamicClassLoader getClassLoader(String url, Properties props)
          Return a new class loader which will connect with the specified url and properties.
 Debug getDebug()
          Returns a Debug object for this driver.
 SybMessageHandler getSybMessageHandler()
          Returns the current message handler object for this driver.
 void setRemotePassword(String serverName, String password, Properties props)
          Set the remote password in the given Properties object.
 void setSybMessageHandler(SybMessageHandler msgHandler)
          Sets the message handler for this driver.
 void setVersion(int version)
          Configures the driver for the desired behavior.
 
Methods inherited from interface java.sql.Driver
acceptsURL, connect, getMajorVersion, getMinorVersion, getPropertyInfo, jdbcCompliant
 

Field Detail

VERSION_2

public static final int VERSION_2
Version 2.x.

Version values can be passed to setVersion to cause the driver to have expected behavior relative to the version of jConnect the application was built with. The default is VERSION_2 since setVersion was not introduced until VERSION_3, and no 2.x application could set VERSION_2. Applications that require more recent behavior must explicitly set a higher version number (or VERSION_LATEST).

When VERSION_2 is specified, the default character-set converter is TruncationConverter unless the character set in use does not allow truncation, in which case the default is PureConverter. For higher versions, the default is always PureConverter. The CANCEL_ALL connection property defaults to true. The LANGUAGE connection property defaults to us_english.

See Also:
CharsetConverter

VERSION_3

public static final int VERSION_3
Version 3.x.

When Version 3 is specified, the default character-set converter is PureConverter. The CANCEL_ALL property defaults to true. The LANGUAGE connection property defaults to us_english.


VERSION_4

public static final int VERSION_4
Versions 4.0, 4.1 and 4.2.

When Version 4 is specified the default character-set converter is PureConverter. The CANCEL_ALL property defaults to false. The LANGUAGE connection property defaults to null, and the initial language used to log in to the database is chosen based upon the application's default localization. Supported languages are chinese, us_english, french, german, japanese, korean, portuguese and spanish.


VERSION_5

public static final int VERSION_5
Versions 5.0 and 5.2

Same behavior as versions 4.0, 4.1 and 4.2.


VERSION_6

public static final int VERSION_6
Versions 4.5 and 5.5

Versions 4.5 and 5.5 allow the user to request XNL widetable support from the server.


VERSION_LATEST

public static final int VERSION_LATEST
Instructs the driver to behave as the latest version. Applications setting this version may see changes when the driver is upgraded.
Method Detail

setVersion

public void setVersion(int version)
                throws SQLException
Configures the driver for the desired behavior. The default version emulation is jConnect2.x.

This method can be called multiple times with different version values. Connections inherit the behavior associated with the version at the time the connection is made. Subsequent changes to the version in the driver have no effect on existing connections.

Parameters:
version - one of the SybDriver.VERSION values
Throws:
SQLException - if the version specified is unrecognized
See Also:
VERSION_2, VERSION_3, VERSION_4, VERSION_5, VERSION_6, VERSION_LATEST

setSybMessageHandler

public void setSybMessageHandler(SybMessageHandler msgHandler)
Sets the message handler for this driver.
Parameters:
msgHandler - message handler to be called when an error occurs or null to turn off error callbacks

getSybMessageHandler

public SybMessageHandler getSybMessageHandler()
Returns the current message handler object for this driver.
Returns:
the message handler

getDebug

public Debug getDebug()
Returns a Debug object for this driver.
Returns:
a Debug object

setRemotePassword

public void setRemotePassword(String serverName,
                              String password,
                              Properties props)
Set the remote password in the given Properties object.

This method can be used repeatedly to add servername/password combinations to the Properties object you provide. This Properties argument can then be used with the DriverManager.getConnection(String URL, Properties props) method.

Parameters:
serverName - name of the remote server
password - password at the remote server
props - the Properties in which to store the server/password

getClassLoader

public DynamicClassLoader getClassLoader(String url,
                                         Properties props)
Return a new class loader which will connect with the specified url and properties.
Parameters:
url - the db url used by the class loader to load classes
props - the connection properties used by the loader to connect to the database containing the classes.
Returns:
a new class loader