我正在运行 ant 任务
在 MySQL-5.7 服务器上执行一些 SQL,但我不想使用 SSL。我目前正在使用 mysql-connector-java-5.1.42.jar
连接到 MySQL-5.7 (v5.7.18-0ubuntu0.16.04.1
)
我的 SQL 属性看起来像这样
<sql
url="jdbc:mysql://mysql.box.lan:3306/mydb?autoReconnect=true&useSSL=false&verifyServerCertificate=false"
userid="my-user"
password="xxx"
driver="com.mysql.jdbc.Driver"
onerror="continue"
showWarnings="false"
delimiter=";"
encoding="UTF-8">
不幸的是,驱动程序似乎并不关心autoReconnect
、useSSL
和/或verifyServerCertificate
的任何组合,如前所述here , here和 here .
确切的错误是
Thu Jun 22 12:20:32 GMT 2017 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.
最佳答案
这个怎么样:
<sql
url="jdbc:mysql://mysql.box.lan:3306/mydb"
userid="my-user"
password="xxx"
driver="com.mysql.jdbc.Driver"
onerror="continue"
showWarnings="false"
delimiter=";"
encoding="UTF-8">
<connectionProperty name="useSSL" value="false" />
<connectionProperty name="verifyServerCertificate" value="false" />
<connectionProperty name="autoReconnect" value="true" />
</sql>
我猜 ant 不解析连接 url 属性/不使用它们进行连接。尝试使用 connectionProperty
设置各个值
关于mysql - SQL Ant 任务 : WARN: Establishing SSL connection without server's identity verification is not recommended,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44699698/