Unable to load Sybase drivers

book

Article ID: 159826

calendar_today

Updated On:

Products

Data Loss Prevention Network Discover

Issue/Introduction

When scanning a Sybase Database via Discover SQL crawlers, the following error occurs.

04/17/09 - 3:35:30 PM sybase://targetserver/target Unable to create a database connection: java.lang.Exception: Unable to load driver for sybase
04/17/09 - 3:35:30 PM  Error trying to scan the database

The same server however is able to scan the SQL Database.

Resolution

The SQL crawler is configured in sqldatabasecrawler.properties in the following way

# Sybase_original
driver_class.sybase =  net.sourceforge.jtds.jdbc.Driver
driver_subprotocol.sybase = jtds:sybase
driver_table_query.sybase = SELECT * FROM sysobjects WHERE type='U'
driver_row_selector.sybase = set rowcount {2.EN_US};select {1.EN_US} from {0.EN_US};set rowcount 0

The error message indicates that the JDBC driver has not been set up properly.  Make sure that the file is placed on the Discover server in Vontu\Protect\lib\jdbc and has full r/w/x permissions for the protect user account.

Usually a good choice is the jTDS driver that can be downloaded from http://jtds.sourceforge.net/ .

As reference, the Setup instructions are outlined in the Vontu DLP 8.1 Admin Guide beginning on page 108, with custom configuration options beginning on page 110.

Another consideration is the Sybase DB and version you are trying to connect to.  You may want to check the following error condition that is outlined in http://jtds.sourceforge.net/faq.html#getConnectionHangs.

TDS uses by default TDS 8.0 (which is SQL Server 2000's protocol) to communicate with the database server. When jTDS sends the 8.0 login request SQL Server 6.5 doesn't understand it so it returns a 4.2 error (Login failed). But because jTDS is expecting a TDS 8.0 packet as a response (not a TDS 4.2 packet) it doesn't properly understand the response packet and it hangs waiting for more data from the server. The solution is to set the "TDS" property to "4.2" (through the URL or Properties object passed to getConnection() or using the appropriate setter of JtdsDataSource, if you are using the JtdsDataSource).
For more information about URL format and the properties that may be passed to jTDS have a look at the jTDS URL format.
The URL format is
http://jtds.sourceforge.net/faq.html#urlFormat
The URL format for jTDS is:
jdbc:jtds:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;...]]
where <server_type> is one of either 'sqlserver' or 'sybase' (their meaning is quite obvious), <port> is the port the database server is listening to (default is 1433 for SQL Server and 7100 for Sybase) and <database> is the database name -- JDBC term: catalog -- (if not specified, the user's default database is used). The set of properties supported by jTDS is:
[...]
TDS (default - "8.0" for SQL Server; "5.0" for Sybase)
The version of TDS to be used. TDS (Tabular Data Stream) is the protocol used by Microsoft SQL Server and Sybase to communicate with database clients. jTDS can use TDS 4.2, 5.0, 7.0 and 8.0. Version 4.2 is used by SQL Server 6.5 and Sybase 10. Version 5.0 is used with Sybase 11 onwards. Version 7.0 is used by SQL Server 7.0; this protocol also works with SQL Server 2000. Version 8.0 is used by SQL Server 2000 and SQL Server 2005.
Newer database server versions usually understand older protocol versions. This means that SQL Server 7.0 can be used with TDS 4.2, but the limitations of the protocol apply regardless of the server version (e.g. when using TDS 4.2 VARCHARs are limited to 255 characters). As a conclusion, you must set this property to "4.2" when connecting to SQL Server 6.5 or Sybase. You should not set this value to "7.0" or "8.0") when connecting to any version of Sybase as these are SQL Server specific protocols. Further, you should not set this value to "5.0") when connecting to any version of SQL Server as this is a Sybase specific protocol.
Currently jTDS automatically falls back from 8.0 to 7.0 (if used with SQL Server 7.0) and from 5.0 to 4.2 (with Sybase 10) so specifying the value for this parameter is only necessary for SQL Server 6.5.
[...]


So in the URL that you pass via the target, adjust the TDS property to 4.2 and retry.