Recent Posts

Those who are free of resentful thoughts surely find peace. - Buddha

JDK8- JDBC ODBC Bridge in Java 8

Posted on 28th Dec 2016

<-Back to Blogs

How to enable JDBC-ODBC bridge for JDK 8

JDK8 had removed JDBC-ODBC bridge and they just don't work in JRE 8 as in JRE8--.  

Follow the step below, you can enable JDBC-ODBC bridge in JDK 8. 

1. Download a JDK7 or JRE 7. 

2. Goto JRE\lib folder and find the rt.jar .

3. Unzip it (if you have WinRAR installed) or you can rename it to 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 JDK1.8 or JRE1.8 lib folder.

8. Copy   jdbcodbc.dll from JRE\bin  of your JRE 7 installation to JRE\bin of your JRE 8 installation.

9. Alternatively instead of doing step 7, add the jdbc.jar in your project classpath.

10. Restart your JVM.

Please find below which shows the complete source code. Note that - Excel/SpreadSheet name is

softhinkers.xlsx and we are reading worksheet - Sheet1.

package com.softhinkers.javaexcel;

import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.DriverManager;
public class Main {
public static void main(String[] args) {
Connection c = null;
Statement stmnt = null;
String Filename = ".\\softhinkers";

try {
String connUrl = "jdbc:odbc:DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Filename + ".xlsx;DriverID=22;readonly=false";
c = DriverManager

stmnt = c.createStatement();
String query = "select * from [Sheet1$];";
ResultSet rs = stmnt.executeQuery(query);

System.out.println("Found the following URLs:");
while ( {
System.out.println(rs.getString("Name") + " " + rs.getString("Company"));
} catch (Exception e) {
} finally {
try {
} catch (Exception e) {



<-Back to Blogs


Good, better, best. Never let it rest. Untill your good is better and your better is best. - St. Jerome

© SOFTHINKERS 2013-18 All Rights Reserved. Privacy policy