Contents | Prev | Next | JDBC TM Guide: Getting Started |
If possible, use a PureJava JDBC driver instead of the Bridge and an ODBC driver. This completely eliminates the client configuration required by ODBC. It also eliminates the potential that the Java VM could be corrupted by an error in the native code brought in by the Bridge (i.e., the Bridge native library, the ODBC driver manager library, the ODBC driver library and the database client library).
The JDBC-ODBC Bridge is a JDBC driver which implements JDBC operations by translating them into ODBC operations. To ODBC it appears as a normal application program.
The Bridge implements JDBC for any database for which an ODBC driver is available.
The Bridge is implemented as the sun.jdbc.odbc
Java package and contains a native library used to access
ODBC.
The Bridge is a joint development of Intersolv and JavaSoft.
The bridge supports ODBC 2.x. This is the version that most ODBC drivers currently support. It will also likely work with most forthcoming ODBC 3.x drivers; however, this has not been tested.
The Bridge is implemented in Java and uses Java native methods to call ODBC.
The Bridge is installed automatically with the JDK as package sun.jdbc.odbc.
See your ODBC driver vendor for information on installing and configuring ODBC. No special configuration is required for the Bridge.
See your database vendor for client installation and configuration information.
On Solaris, some ODBC driver managers name their libs libodbcinst.so
and libodbc.so
. The Bridge expects
these libraries to be named libodbcinst.so.1
and libodbc.so.1,
so symbolic links for these names must be
created.
The Bridge is used by opening a JDBC connection using a URL with the odbc
subprotocol. See below for URL
examples.
Prior to connecting, the bridge driver class, sun.jdbc.odbc.JdbcOdbcDriver,
must either be added to the
java.lang.System
property named jdbc.drivers,
or it must be explicitly loaded using the Java class loader.
Explicit loading is done with the following line of code:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
When loaded, the ODBC driver (like all good JDBC drivers) creates an instance of itself and registers this with the JDBC driver manager.
JDBC used with a PureJava JDBC driver works well with applets. The Bridge driver does not work well with applets.
Since the Bridge is an optional component of the JDK it may not be provided by a browser. Even if it is provided, only trusted applets (those allowed to write to files) will be able to use the Bridge. This is required inorder to preserve the security of the applet sandbox. Finally, even if the applet is trusted, ODBC and the DBMS client library must be configured on each client.
From Solaris, we have used the Bridge to access Oracle 7.1.6 and Sybase Version 10 running on Solaris. From NT, we have used the Bridge to access SQL Server 6.x.
Visigenic provides ODBC drivers which have been tested with the the Bridge. Drivers are available for Oracle,
Sybase, Informix, Microsoft SQL Server, and Ingres. To purchase the ODBC DriverSet 2.0 please contact
Visigenic sales at 415-312- 7197, or visit the web site www.visigenic.com
.
The INTERSOLV ODBC driver suite should be completely compatible with the JDBC-ODBC bridge. The
following drivers have successfully passed a minimal test suite: Oracle, xBASE, Sybase (Windows NT/95 only),
Microsoft SQL-Server, and Informix. To evaluate or purchase INTERSOLV ODBC drivers, please contact
INTERSOLV DataDirect Sales at 1 800-547-4000 Option 2 or via the World Wide Web at
http:\\www.intersolv.com
.
The MS SQL Server driver has also been used successfully on NT.
Many other ODBC drivers will likely work.
On Solaris, we have found that the Sybase ctlib-based drivers don't work because ctlib has a signal-handling conflict with the Java VM. This is likely not a problem on NT due to differences in the NT Java VM; however, this has not been verified.
Some ODBC drivers only allow a single result set to be active per connection.
The Bridge driver uses the odbc
subprotocol. URLs for this subprotocol are of the form:
jdbc:odbc:<data-source-name>[;<attribute-name>=<attribute-value>]*
For example:
jdbc:odbc:sybase jdbc:odbc:mydb;UID=me;PWD=secret jdbc:odbc:ora123;Cachesize=300
The Bridge provides extensive tracing when DriverManager
tracing is enabled. The following line of code
enables tracing and sends it to standard out:
java.sql.DriverManager.setLogStream(java.lang.System.out);
The Bridge assumes that ODBC drivers are not reentrant. This means the Bridge must synchronize access to these drivers. The result is that the Bridge provides limited concurrency. This is a limitation of the Bridge. Most Pure Java JDBC drivers provide the expected level of concurrent access.
Copyright © 1996, 1997 Sun Microsystems, Inc. All rights reserved.