我正在运行MATLAB R2018a,并尝试使用数据库工具箱将其连接到我的MySQL 8.0.11服务器。我使用的是this page as a guide。
我已经使用MySQL安装程序安装了Connector J8.0,并将文件添加到类路径(如上所述)。运行javaclasspath会给我带来:
STATIC JAVA PATH
C:\Program Files\MATLAB\R2018a\java\patch
[.. removed many files]
C:\Program Files\MATLAB\R2018a\java\jar\zh_CN\webintegration_res.jar
C:\Program Files (x86)\MySQL\Connector J 8.0\mysql-connector-java-8.0.11.jar
DYNAMIC JAVA PATH
<empty>因此,这似乎是正确的。然后我尝试(如here所述):
d = com.mysql.cj.jdbc.Driver;
urlValid = d.acceptsURL('jdbc:mysql://localhost:3306/[*removed*]');
props = java.util.Properties;
props.put('user',[*removed*]); props.put('password',[*removed]*);
con = d.connect('jdbc:mysql://localhost:3306/[*removed*]',props)它告诉我
Tue Aug 07 10:59:16 CEST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
con =
com.mysql.cj.jdbc.ConnectionImpl@ea27e34所以这一切看起来都很好。和:
con2 = database('[*removed*]', '[*removed*]', '[*removed*]', 'com.mysql.cj.jdbc.Driver', 'jdbc:mysql://localhost:3306/[*removed*]')也可以正常工作。
然而,
如果我尝试使用MATLAB的($400/年)数据库工具箱连接到数据库,我得到"Unable to find JDBC driver file on MATLAB Java class path“。

是我做错了什么,还是这是个bug?有人知道怎么解决这个问题吗?
根据this answer的说法,版本应该是兼容的。
发布于 2018-08-07 17:27:19
嗯,这看起来确实是个bug。
我只是注意到“测试”按钮没有灰显,正如你在问题中的图像中所看到的那样。在输入我的数据库详细信息并推送它之后,我可以输入我的用户名和密码,这将返回
Connection successful!然后,通过保存它,关闭配置面板并使用"New Query“连接到数据库,我现在就成功地连接到了我的数据库。
https://stackoverflow.com/questions/51722966
复制相似问题