Why is MATLAB unable to find the JDBC Driver?

19 Ansichten (letzte 30 Tage)
Raymond Chiu
Raymond Chiu am 24 Jul. 2018
Kommentiert: Karim Ushama am 26 Mai 2021
Attempts, from MATLAB, to connect to a database fail.
conn = database(dbsource,username,password,'Vendor','MySQL', 'Server','mysql8.db4free.net','portnumber',3306)
Error message: *Unable to find JDBC driver*
[![enter image description here][1]][1]
The [JDBC driver][2] was:
- copied from [https://dev.mysql.com/downloads/file/?id=477058][3]
- copied to C:\drivers\mysql-connector-java-8.0.11\mysql-connector-java-8.0.11.jar
- added to the JDBC static path
- path \ filename was verified:
[![enter image description here][4]][4]
QUESTIONS ====
1) Is there enough information here to diagnose the root cause of the error message?
2) What is the root cause and corrective action?
3) Why does MATLAB indicate the JDBC driver file is not on the java classpath? Remedy?
Responses to requests for additional diagnostic information will be added to the original posting.
UPDATE === Attempt to configure MATLAB's database explorer app returned the message:
JDBC driver file was not found on MATLAB java classpath
[![enter image description here][5]][5]
Java version:
[![enter image description here][6]][6]
[1]:
[2]:
[3]:
[4]:
[5]:
[6]:
  1 Kommentar
Walter Roberson
Walter Roberson am 24 Jul. 2018
You show the JAVA dynamic path as being empty. I do not see where you are adding C:\drivers\mysql-connector-java-8.0.11\mysql-connector-java-8.0.11.jar to your MATLAB classpath ?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Raymond Chiu
Raymond Chiu am 25 Jul. 2018
A clever peer solved this problem with V5.1:
Connector/J 8.0 (including mysql-connector-java-8.0.11.jar) supports only JRE 1.8.x. But MATLAB R2017a uses JRE 1.7, so mysql-connector-java-8.0.11.jar is not supported in R2017a.
Connector/J 5.1 Connector/J 5.1 supports JRE 1.7, so it works with MATLAB R2017a and also it supports MySQL Server 8.0.

Weitere Antworten (1)

Pieume Ulrich
Pieume Ulrich am 1 Mai 2019
Hello guys I'm using the R2017b and i consulted the version of my JRE and saw that it was 'Java 1.8.0_121-b13'. with this advance i am eligable for the 'mysql-connector-java-8.0.11.jar' driver but yet I still have the same response 'JDBC driver is not found on MATLAB java class path'.
Please I would like to have the complete procedure to connect my MATLAB to mysql using 'JDBC' driver please,
ùy email: pieumeulrich@gmail.com

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by