java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver doesn't work anymore in java. How to fix this?

前端 未结 2 1815
执念已碎
执念已碎 2021-01-24 01:31

It worked two days ago. Now it doesn\'t. I\'m 100% sure the coding is correct. This is the way I used to connect the database. Couldn\'t find an answer yet to my problem. Please

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-24 01:52

    Based on the comments, your system is now running on the Java 8 JRE. The ODBC Bridge has been removed from this, and all future versions. You need to find a native JDBC driver for the database you want to connect to, and put that on your classpath.

    java -classpath "[/path/to/your/driver.jar];." [yourclassname]
    

    Alternatively, you could explicitly use the JDK 7 runtime, but I'd recommend against this. You've uncovered a compatibility problem, and it's better to solve it than to try to work around it.

提交回复
热议问题