Friday 28 October 2016

JDBC-ODBC Bridge support in Java 8

JDBC-ODBC Bridge offered lot of flexibility in connecting a data source. Many had used this bridge to connect & query MS Excel / MS Access as a database. Starting from Java 8, Oracle has removed this feature. This created a major blocker for many to upgrade to new Java version & many applications which were built based on this have failed.

As an interim solution, one can build an extension from jdbc classes of previous java version & add it to Java 8 extensions.

Follow the below steps to enable the JDBC-ODBC Bridge support in Java 8.



Steps:


  1. Download Java 7 (JDK 7 or JRE 7).
  2. Find the rt.jar under JRE\lib folder.
  3. Rename rt.jar to rt.zip and unzip the jar.
  4. Copy sun\jdbc and sun\security\action folders into a new folder and retain the folder structure & class files in it.
    Folder structure should look like below:
    sun --> security --> action
             --> jdbc
  5. Open a command prompt, CD to the folder where the ‘sun’ folder is placed.
    Run the command: "jar -cvf jdbc.jar sun".
  6. This command would create a new file named jdbc.jar.
  7. Copy jdbc.jar to your JDK8 or JRE8 lib\ext folder.
    Ex: C:\Program Files (x86)\Java\jre1.8.0_92\lib\ext
  8. Copy jdbcodbc.dll from JRE\bin of JRE 7 installation to JRE\bin of JRE 8 folder.
    Ex: C:\Program Files (x86)\Java\jre1.8.0_92\bin
  9. Restart the System or JVM.

You are done... Get all the JDBC-ODBC classes available in java 8.






References:
http://stackoverflow.com/questions/14229072/removal-of-jdbc-odbc-bridge-in-java-8
http://bigfatball.blogspot.in/2016/03/how-to-enable-jdbc-odbc-bridge-for-jdk-8.html



No comments:

Post a Comment