1. The concept of ajdbc-odbc bridge
The JDBC-ODBC bridge is a JDBC driver that converts JDBC operations by converting JDBC operations to ODBC operations. For ODBC, it is like a usual application, and the bridge implements JDBC for all databases available to ODBC. It is implemented as a Sun.jdbc.odbc package, which contains a local library for accessing ODBC. The bridge is developed by INTERSOLV and Java Soft. Since ODBC is used extensively, the bridge has the advantage that JDBC can access almost all databases. The bridge supports ODBC 2.x, which is the version of most data ODBC drivers supported. The bridge is automatically installed with JDK as a package sun.jdbc.odbc, without special configuration.
It is recommended to use the pure Java JDBC driver instead of bridge and ODBC driver as much as possible, which can complete the client configuration required for ODBC, eliminating the local code introduced by the Java virtual machine (ie bridge local library, ODBC) The possibility of errors in the driver manager library, ODBC driver library, and database client library.
2. Using the JDBC-ODBC Bridge
With the ODBC sub-protocol, you can use the URL to open the JDBC connection to use the bridge. Before establishing the connection, you must add the bridge driver class Sun.jdbc.odbc.jdbcodbdriver in the java.lang.system property named JDBC.DRIVERS, or explicitly load it with the Java class loader. It can be used to perform an explicit loading of the bridge with a lower line:
Class.Forname ("Sun.jdbc.odbc.jdbcodbcdriver");
When loading, the ODBC driver (like all JDBC drivers) will create its own instance and register at the JDBC Driver Manager.
3. JDBC URL supported by JDBC-ODBC Bridge
The bridge driver uses an ODBC sub protocol. The URL of the sub protocol is the following form:
JDBC: ODBC:
E.g:
JDBC: ODBC: Sybase
JDBC: ODBC: MYDB; UID = Me; PWD = SECRET
JDBC: ODBC: ORA123; Cachesize = 300