I'm running an ant task
doing some SQL on a MySQL-5.7 server and I don't want to use SSL. I'm currently using mysql-connector-java-5.1.42.jar
to connect to a MySQL-5.7 (v5.7.18-0ubuntu0.16.04.1
)
My SQL properties look like this
<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">
Unluckily the driver does not seem to care about any combination of autoReconnect
, useSSL
and/or verifyServerCertificate
, as mentioned here, here and here.
Exact error is
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.
How about this:
<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>
I'm guessing that ant doesn't parse the connection url properties/doesn't use them for connecting. This seems like a "logical" thing to try by using connectionProperty
to set the individual values