简体   繁体   中英

ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver, how to fix it

it gives exception of java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver

int row=0;
    try {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Con=DriverManager.getConnection("jdbc:odbc:MSDB");
        stmt=Con.createStatement();
        String sql="select c_name from candidates";
        RS=stmt.executeQuery(sql);
        while(RS.next())
        {
            String name=RS.getString("c_name");
            c1.addItem(name);
            row++;
        }
       }
    catch (Exception ex) {
        JOptionPane.showMessageDialog(null,"" + ex);ex.printStackTrace();
       }

Sun's and Oracle's official positions have long been that --

the [JVM-bundled] JDBC-ODBC Bridge should be considered a transitional solution [...] Oracle [was Sun] does not support the JDBC-ODBC Bridge.

However, my employer, OpenLink Software , has produced enterprise-grade commercial Type 1 Bridges between JDBC and ODBC since JVM 1.0, and these are fully compatible with the current JVM 1.8. You can learn more here --

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM