-->

sun.jdbc.odbc.JdbcOdbcDriver not working with jdk

2019-01-29 07:52发布

问题:

I downloaded jdk8u40 and now I get:

SQLException:
SQLState: 08001
Message:  No suitable driver found for jdbc:odbc:mysqlDB
Vendor:   0

where mysqlDB is my data source name.

I use:

jdbc.drivers=sun.jdbc.odbc.JdbcOdbcDriver
jdbc.url=jdbc:odbc:mysqlDB

as connection strings. I have downloaded and installed driver:

mysql-connector-odbc-5.3.4-winx64.msi

I read in your forums that the jdbc-odbc bridge is no longer supported in jdk 1.8. Any help appreciated.

回答1:

The JDBC-ODBC bridge is no longer shipped/supported with JDK 8, hence the errors:

The JDBC-ODBC Bridge should be considered a transitional solution; it will be removed in JDK 8. In addition, Oracle does not support the JDBC-ODBC Bridge. Oracle recommends that you use JDBC drivers provided by the vendor of your database instead of the JDBC-ODBC Bridge.

If you're using Java, it would be better to use a JDBC driver instead of an ODBC driver, see here http://dev.mysql.com/downloads/connector/j/ for the MySQL JDBC driver.



回答2:

In regards to the comment "I read in your forums that the jdbc-odbc bridge is no longer supported in jdk 1.8. Any help appreciated."

Please note that can obtain JDBC-ODBC Type 1 Bridge Drivers from third parties. For example, OpenLink Software continues to provide an JDBC-ODBC Bridge Driver for past and current Java Virtual Machine editions:

  1. Single-Tier JDBC-ODBC Bridge Driver
  2. Single-Tier ODBC-JDBC Bridge Driver