xiaohan2012
xiaohan2012

Reputation: 10342

Charset string appended with dbname when using jdbc to connect to Mysql in Matlab

I am trying to set the charset when letting Matlab connect to remote mysql database server.

The connection url is like this:

jdbc:mysql://host/mtdb?useUnicode=true&characterEncoding=UTF8

And after executing:

c = database("mydb", 'username', 'password','com.mysql.jdbc.Driver', "connection_string as above");

But Matlab throws an exception:

'Unsupported character encoding 'UTF8mydb'.

I cannot see why character encoding is appended with "mydb". I don't see any syntax error in the connection url format.

Upvotes: 1

Views: 1058

Answers (1)

Amro
Amro

Reputation: 124563

Try this instead:

dbURL = 'jdbc:mysql://localhost/mydb?useUnicode=true&characterEncoding=UTF8';
conn = database('', 'user', 'pass', 'com.mysql.jdbc.Driver', dbURL)
curs = exec(conn, 'select * from table')

Upvotes: 1

Related Questions