Removal of JDBC ODBC bridge in java 8

Karthik picture Karthik · Jan 9, 2013 · Viewed 68.3k times · Source

Starting with Java 8, the JDBC-ODBC Bridge will no longer be included with the JDK.

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // classNotFoundException is thrown

Is there any other solution connecting JDBC-ODBC Bridge?

Answer

frhack picture frhack · Apr 26, 2016

We can still use JDBC-ODBC Bridge in java 8 too, just follow this simple recipe:

  1. Download a JDK 7 or JRE 7.
  2. Goto JRE\lib folder and find the rt.jar
  3. Unzip it (if you have WinRAR or 7zip installed) or you can rename it to rt.zip and unzip it.
  4. Copy sun\jdbc and sun\security\action folders out, keep the folder structure. i.e., you should have the folder structure like below:

    Sun --> Security --> Action
        --> JDBC
    
  5. Open a CMD window. Go to the parent folder of Sun folder. Run the command: jar -cvf jdbc.jar sun

  6. The above command will create a file named jdbc.jar
  7. Copy JDBC.jar to your JDK8 or JRE8 lib folder. If that doesn't work try the lib\ext folder.
  8. Copy jdbcodbc.dll from JRE\bin of your JRE 7 installation to JRE\bin of your JRE 8 installation.
  9. Restart your JVM.

How to enable JDBC-ODBC bridge for JDK 8