Why do I receive the error 'Data source not found' when using Visual Query Builder in Database Toolbox 3.0.1 (R14SP1) to connect to a MySQL database with a JDBC driver?

3 views (last 30 days)
I am trying to establish a connection to a MySQL database on Linux Suse using the DATABASE command:
conn = database('databasename','username','password', 'driver','databaseurl')
However, I receive the following error: ERROR: Driver not found/loaded
Also, when I attempt to use the CONFDS function and enter the database name, driver name, and server URL, I receive the error: ERROR: Data source not found

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Feb 2018
These error messages indicate that the data source for the JDBC driver is not set correctly.
To connect to MySQL database with JDBC driver, perform the following steps:
1. Add a JAR file reference to the dynamic java class path using the JAVAADDPATH command in the STARTUP.m file. For example, include this line to the STARTUP.m file:
javaaddpath('C:/Program
Files/Java/jre6/lib/ext/mysql-connector-java-5.1.12-bin.jar');
2. Restart MATLAB.
3. Establish the database connection again using the DATABASE command. Ensure that the name in the data source listbox of the Visual Query Builder exactly matches the data source name. Also note that the driver filename, for example
mysql/mysql-connector-java-5.1.12-stable/mysql-connector-java-5.1.12-stable-bin.jar
is different from the classname (the 'driver' argument) that needs to be passed to the DATABASE command.
For information on how to set up JDBC data sources, refer to the documentation at
To learn more about the DATABASE command, execute
doc database
at the MATLAB command prompt.

More Answers (0)

Products


Release

R14SP1

Community Treasure Hunt

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

Start Hunting!