Configure JDBC connection on Mojave
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I'm new in the community but before to make my question I tried unsuccessfully to find the answer in a lot of topics.
I need to create a connection by code to a localhost mySQL database in OSX Mojave.
First of all I downloaded the Connector/J 8.0.16 Platform Independent driver called 'mysql-connector-java-8.0.16.jar' and I copied it in a subfolder of my rootfolder called Jconnector with the following code:
rootfolder = '/Users/User/Documents/MATLAB/MatlabResearch/RobustTS/';
addpath(rootfolder);
% jdbc
jdbcfolder = [rootfolder 'Jconnector/'];
jdbcjarfile = 'mysql-connector-java-8.0.16.jar';
% database
databasename = 'RAWDATA';
user = 'root';
password = 'password';
driver = 'com.mysql.cj.jdbc.Driver';
databaseurl = ['jdbc:mysql://localhost:3306/' databasename];
% table name(s)
table_indexed = 'mytable';
table = table_indexed;
% add jdbc driver info
javaaddpath([jdbcfolder jdbcjarfile]);
% connect to database
conn = database(databasename, user, password, driver, databaseurl);
And I get this error:
Warning: Invalid file or directory
'/Users/User/Documents/MATLAB/MatlabResearch/RobustTS/Jconnector/mysql-connector-java-8.0.16.jar'.
> In javaclasspath>local_validate_dynamic_path (line 271)
In javaclasspath>local_javapath (line 187)
In javaclasspath (line 124)
In javaaddpath (line 71)
And the message in the connection proprierties. 'No suitable driver found ...'
I can't understand if my procedure fails in the code of in some preliminary step (like managing of JAVACLASS).
Could someone help me? I would be very glad.
Thanks in advance,
Gian
0 comentarios
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!