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?
解决方案
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/';