Connecting to Excel using JDBC 8
<p>I've written a code that will be querying data from Excel using <code>odbc</code> bridge. Now since in java8 there is no more support to <code>odbc</code>, I'm searching an alternative of the same. I've nearly 32 different programs of suce. i.e. querying from Excel Database. Below is a sample program.</p>

<pre><code>private void getTheDetailedDataForRca(String userName, XSSFWorkbook workbook, XSSFSheet sheet) {
        // System.out.println("ph2");
        try {
            DecimalFormat df2 = new DecimalFormat("#.##");
            HashMap&lt;String, HashMap&lt;String, Double&gt;&gt; myArray;
            myArray = new HashMap&lt;String, HashMap&lt;String, Double&gt;&gt;();
            String user = "%" + userName + "%";

            String dburl = path.getDBUrl();

            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            myConn = DriverManager.getConnection(dburl);
            String queryString = "select Error As Err, Sum(TotalErrors) as Errors from [Quality Sheet$] where Associate like ? group By Error";
            PreparedStatement ps = myConn.prepareStatement(queryString);
            ps.setString(1, user);
            ResultSet rs = ps.executeQuery();
            myArray.put(userName, new HashMap&lt;String, Double&gt;());

            while (rs.next()) {
                double inputValue = rs.getDouble("Errors");
                String fin = df2.format(inputValue);
                myArray.get(userName).put(rs.getString("Err"), Double.parseDouble(fin));
            }
            ps.close();
            myConn.close();
            printMapOne(myArray, userName, workbook, sheet);
        } catch (Exception e) {
            System.out.println(e + "\t" + "in finals sheet B2");
        }
    }
</code></pre>

<p>And my dburl is</p>

<pre><code>public String getDBUrl() {
    return "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\\Users\\" + getSystemId
            + "\\Desktop\\Quality Sheets\\quality_template.xlsx;";
}
</code></pre>

<p>I checked it online and to my surprise I found nothing apart from suggesting to use <code>POI</code>. I tried with <code>UCanAccess</code>, but this supports only Access database. Can someone please let me know any alternate for <code>odbc</code>, so that I need not code the entire thing.</p>

<p>I've tried the solution given at <a href="https://stackoverflow.com/questions/14229072/removal-of-jdbc-odbc-bridge-in-java-8/36875001#36875001">Removal of JDBC ODBC bridge in java 8</a></p>

<p>I got the message as below in cmd.</p>

<pre><code>C:\Users\u0138039\Desktop\sun&gt;jar -cvf jdbc.jar sun
sun : no such file or directory
added manifest
</code></pre>

<p>But a jar is created in folder.</p>

<p>I pasted the same jdbc driver in <code>C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib</code> and copied <code>jdbcodbc.dll</code> to <code>C:\Program Files (x86)\Java\jre1.8.0_101\bin</code>, restarted and to my surprise I get the same <code>java.sql.SQLException: No suitable driver found for jdbc:odbc</code> Exception.</p>

<p>Thanks</p>