3

I am trying to connect to MySQL database with the following code in Matlab, but I am getting the error message

"No suitable driver found for jdbc:mysql://mydatabasehost.amazonaws.comMyDatabase"

databaseName = 'MyDatabase';
username = 'myusername';
password = 'mypassword';
jdbcDriver = 'com.mysql.jdbc.Driver';
server = ' jdbc:mysql://mydatabasehost.amazonaws.com';

conn = database(databaseName, username, password, jdbcDriver, server);

I am using Matlab R2012 (64bit). I have already downloaded and installed the JDBC connector for Windows from http://dev.mysql.com/downloads/connector/j/ I have added it to classpath.txt of Matlab (alternatively use javaaddpath(location of the jdbc driver). Am I missing a step?

cloudviz
  • 971
  • 4
  • 15
  • 40
  • Does this answer your question? [Java program and mySQL connectivity issue: No suitable driver found](https://stackoverflow.com/questions/9777880/java-program-and-mysql-connectivity-issue-no-suitable-driver-found) – rjzii Dec 09 '19 at 21:47

2 Answers2

4

Ok closing this question.

The issue is the spacing at the beginning

server = ' jdbc:mysql://mydatabasehost.amazonaws.com';

Also I should have included the port number

server = 'jdbc:mysql://mydatabasehost.amazonaws.com:3306/';
cloudviz
  • 971
  • 4
  • 15
  • 40
0

Download the JDBC driver and put in classpath, extract the ZIP file and put the containing JAR file in the classpath.

And try to use double quotes

Up_One
  • 5,213
  • 3
  • 33
  • 65