mysql - SQL Ant 任务 : WARN: Establishing SSL connection without server's identity verification is not recommended

标签 mysql maven-ant-tasks

我正在运行 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&amp;useSSL=false&amp;verifyServerCertificate=false"
    userid="my-user"
    password="xxx"
    driver="com.mysql.jdbc.Driver"
    onerror="continue"
    showWarnings="false"
    delimiter=";"
    encoding="UTF-8">

不幸的是,驱动程序似乎并不关心autoReconnectuseSSL 和/或verifyServerCertificate 的任何组合,如前所述here , herehere .

确切的错误是

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 设置各个值

似乎是一件“合乎逻辑”的事情

https://ant.apache.org/manual/Tasks/sql.html

关于mysql - SQL Ant 任务 : WARN: Establishing SSL connection without server's identity verification is not recommended,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44699698/

相关文章:

ant - 如何部署使用 maven-antrun-plugin 创建的 zip 文件?

Java - 由于 UnsupportedClassVersionError,Ant 构建和部署到 JBoss 失败

mysql - 使用vb.net在mysql数据库上倒计时日期

mysql - MySQL 中的空值比较

php - 使用php将相似的数据插入到两个表中

java - Maven Ant 任务 - 依赖关系

maven - 将jar解压到与文件同名的文件夹中

Maven ant 任务部署到公共(public)关系存储库而不是指定的 url

mysql - 动态数据库列?

javascript - 提交表单时,如何检查用户的电子邮件是否已在我的数据库中?