java.sql.SQLException: This version of the JDBC driver is only compatible with Elasticsearch version vUnknown [Unknown], attempting to connect to a server version 6.7.1
at org.elasticsearch.xpack.sql.jdbc.JdbcHttpClient.checkServerVersion(JdbcHttpClient.java:94)
at org.elasticsearch.xpack.sql.jdbc.JdbcHttpClient.(JdbcHttpClient.java:43)
at org.elasticsearch.xpack.sql.jdbc.JdbcConnection.(JdbcConnection.java:49)
at org.elasticsearch.xpack.sql.jdbc.EsDriver.connect(EsDriver.java:76)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.example.demo.TestController.getConnection(TestController.java:36)
at com.example.demo.TestController.selectCount(TestController.java:48)
at com.example.demo.TestController.test(TestController.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
at
@zhu1289303556 I've tested this version of the driver in a simple java application and I'm not seeing this behavior. Can you post the Maven pom file you are using in this test?
@dadoonet@Andrei_Stefan
put x-pack-sql-jdbc-6.7.1.jar into "jre/ lib/ext /" and it can execute normally. I think it's the classloader of springboot that loads the x-pack-sql-jdbc quoted by Maven and can't read the version. Check org.elasticsearch.xpack.sql.client.Version URL url = Version.class.getProtectionDomain().getCodeSource().getLocation(); no information can be obtained.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.