问题
My environment:
OS: centos 7.6.1810
database: 10.3.14-MariaDB
jdbc driver: mariadb-java-client 2.4.1
jdbc parameter: jdbc:mysql://db_ip:3306/dbname?useUnicode=true&characterEncoding=utf8mb4&useSSL=true&trustServerCertificate=true
java: openjdk version "1.8.0_201"
ap server: wildfly 16
MariaDB SSL configuration tested below:
mysql mysql --ssl
MariaDB [mysql]> status
--------------
mysql Ver 15.1 Distrib 10.3.14-MariaDB, for Linux (x86_64) using readline 5.1
Connection id: 68
Current database: mysql
Current user: root@localhost
SSL: Cipher in use is DHE-RSA-AES256-GCM-SHA384
Current pager: less
Using outfile: ''
Using delimiter: ;
Server: MariaDB
Server version: 10.3.14-MariaDB MariaDB Server
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 24 min 1 sec
When I tried to establish ssl connection to mariadb using jdbc, I got the following exception:
Caused by: javax.net.ssl.SSLException: Unsupported record version Unknown-0.0
at sun.security.ssl.InputRecord.checkRecordVersion(InputRecord.java:552)
at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:565)
at sun.security.ssl.InputRecord.read(InputRecord.java:529)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.handleConnectionPhases(AbstractConnectProtocol.java:437)
... 87 more
The jdbc driver should be the latest version, It worked before I upgrade mariadb to 10.3.14, I already tried several jdbc driver version but none worked. What should I try to solve this problem.
来源:https://stackoverflow.com/questions/55643702/mariadb-ssl-connection-error-unsupported-record-version-unknown-0-0