Java 8:classnotfoundexception:sun.jdbc.odbc.jdbcodbcdriver

Source: Internet
Author: User
Tags odbc

In the blink of an end, Java 11 is almost ready to roll.

And I have been in the Java 7 environment to write code, really do not want to upgrade, do not want to change anything, the world is changing every day.

Recently, because the server needs SNI, and Java 7 only support the client's SNI, only upgrade to Java 8 to use the service side of SNI, I am afraid to upgrade to Java 8, the original code is affected, I found a computer installed in the normal use of Java 8.

Ran a bit of code, and sure enough to encounter the problem: ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver

Online search for the relevant information, said that JDK8 removed the Jdbc-odbc bridge (starting from Java 8, JDBC-ODBC Bridge will no longer be included in the JDK.) ), and then find a solution: extracting JDBC from Java 7

1. Download JDK 7 or JRE 7.

2. Go to the JRE \ Lib folder and locate 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 the Sun \ JDBC and Sun \ Security \ Action folders, preserving the folder structure. That is, you should have the following folder structure:

Sun--Security--Action

Sun-To-JDBC

5. Open a CMD window. Go to the parent folder of the Sun folder. Run command: JAR-CVF Jdbc.jar Sun

6. The above command will create a file named Jdbc.jar

7. Copy the Jdbc.jar to your JDK8 or JRE8 lib folder. If this doesn't work, try using the Lib\ext folder.

8. Copy Jdbcodbc.dll from JRE \ Bin installed on JRE 7 to the JRE \ Bin installed in JRE 8.

9. Restart your JVM.

Source:

Https://stackoverflow.com/questions/14229072/removal-of-jdbc-odbc-bridge-in-java-8

Http://bigfatball.blogspot.com/2016/03/how-to-enable-jdbc-odbc-bridge-for-jdk-8.html

Java 8:classnotfoundexception:sun.jdbc.odbc.jdbcodbcdriver

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.