MySQL jdbc server not working with Matlab 2019

Hi
I changed from Matlab 2018 to 2019 and suddenly I have problems with the MySQL JDBC-Driver. Although it is installed, Matlab can't find it, and I get the following error message:
JDBC Driver Error: No suitable driver found for jdbc:mysql:
Any idea why this might be the case?
Cheers
Renger

 Akzeptierte Antwort

Kojiro Saito
Kojiro Saito am 1 Dez. 2019

0 Stimmen

You need to copy javaclasspath.txt from prefdir of R2018a (orR2018b) to prefdir of R2019a. In javaclasspath.txt, I suppose you had described the location of MySQL JDBC driver path.
Instead of using javaclasspath.txt, we can use configureJDBCDataSource from R2019a and it's easier to preset MySQL JDBC driver path. Here is a link of documenation.

6 Kommentare

Sorry for not reacting earlier, but I was on holiday.
I added the path to my javaclasspath.txt and Matlab finds the driver, but now I get the following error running the command
fetch(conn,'SELECT * FROM scenarios;');
Error using database.jdbc.connection/fetch>errorhandling (line 573)
JDBC Driver Error: No database selected
If I display the connection information from "conn", I get
connection with properties:
DataSource: 'nexus_5country_agg_euloads'
UserName: 'renger'
Driver: 'com.mysql.cj.jdbc.Driver'
URL: 'jdbc:mysql://localhost:33 ...'
Message: ''
Type: 'JDBC Connection Object'
Database Properties:
AutoCommit: 'on'
ReadOnly: 'off'
LoginTimeout: 0
MaxDatabaseConnections: 0
Catalog and Schema Information:
DefaultCatalog: ''
Catalogs: {'cge', 'em', 'information_schema' ... and 18 more}
Schemas: {}
So there is a datadriver and a database..., but a problem with the fetch command.
Cheers
Renger
I think conn's DefaultCatalog is empty ('') and so, JDBC Driver doesn't understand which catalog (=database) should be accessed.
How about specifying the database in fetch? I assume nexus_5country_agg_euloads is the database name you want to access.
fetch(conn,'SELECT * FROM nexus_5country_agg_euloads.scenarios;');
Or another way, do use command to specify the database name before doing fecth.
sqlquery = 'use nexus_5country_agg_euloads';
execute(conn, sqlquery) % Let MySQL know which database will be used
fetch(conn,'SELECT * FROM scenarios;');
Thanks!
renger
back again: I am running the same script on our university server using 2018a and have now the default catalogue also defined -> no problem:
conn =
connection with properties:
DataSource: 'nexus'
UserName: 'jared'
Driver: 'com.mysql.jdbc.Driver'
URL: 'jdbc:mysql://itet-psl-s02 ...'
Message: ''
Type: 'JDBC Connection Object'
Database Properties:
AutoCommit: 'on'
ReadOnly: 'off'
LoginTimeout: 0
MaxDatabaseConnections: 0
Catalog and Schema Information:
DefaultCatalog: 'nexus'
Catalogs: {'cge', 'em', 'information_schema' ... and 22 more}
Schemas: {}
Database and Driver Information:
DatabaseProductName: 'MySQL'
DatabaseProductVersion: '8.0.18'
DriverName: 'MySQL Connector/J'
DriverVersion: 'mysql-connector-java-8.0. ...'
Using 2019a-Update 5 makes the connection but the default catalogue in the connection is empty. Is this a bug that has been solved in 2019b (I couldn't find it in the documentation)?
DataSource: 'nexus'
UserName: 'jared'
Driver: 'com.mysql.cj.jdbc.Driver'
URL: 'jdbc:mysql://itet-psl-s02 ...'
Message: ''
Type: 'JDBC Connection Object'
Database Properties:
AutoCommit: 'on'
ReadOnly: 'off'
LoginTimeout: 0
MaxDatabaseConnections: 0
Catalog and Schema Information:
DefaultCatalog: ''
Catalogs: {'cge', 'em', 'information_schema' ... and 22 more}
Schemas: {}
Database and Driver Information:
DatabaseProductName: 'MySQL'
DatabaseProductVersion: '8.0.18'
DriverName: 'MySQL Connector/J'
DriverVersion: 'mysql-connector-java-8.0. ...'
Cheers
Renger
Kojiro Saito
Kojiro Saito am 19 Dez. 2019
Bearbeitet: Kojiro Saito am 19 Dez. 2019
I've discussed with developers of Database Toolbox and this issue seems to be the same as reported in this URL. So, they think it is fixed in R2019a Update 2 and R2019b. I'm wondering why you have this issue in R2019a Update 5.
Hi Kojiro
The version R2019a Update 5 is running on the university server (Unix/Linux). Might that be an explanation?
Cheers
Renger

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Version

R2019a

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by