# This version of the JDBC driver is only compatible with Elasticsearch version vUnknown \[Unknown\],

**URL:** <https://discuss.elastic.co/t/this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown/211894>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [December 15, 2019, 2:46am UTC](https://discuss.elastic.co/t/this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown/211894 "2019-12-15T02:46:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhu1289303556](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zhu1289303556/32/59439_2.png) [@zhu1289303556](https://discuss.elastic.co/u/zhu1289303556)\
**Post date:** [December 15, 2019, 2:46am UTC](https://discuss.elastic.co/t/this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown/211894/1 "2019-12-15T02:46:48Z")

</div>

hello everyone，jdbc driver get version error

use jdbc 6.7.1

org.elasticsearch.plugin x-pack-sql-jdbc 6.7.1

mvn clean package

Maven runs after packaging

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

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [December 16, 2019, 12:32pm UTC](https://discuss.elastic.co/t/this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown/211894/2 "2019-12-16T12:32:23Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![zhu1289303556](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zhu1289303556/32/59439_2.png) [@zhu1289303556](https://discuss.elastic.co/u/zhu1289303556)\
**Post date:** [December 16, 2019, 12:50pm UTC](https://discuss.elastic.co/t/this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown/211894/3 "2019-12-16T12:50:30Z")

</div>

\<?xml version="1.0" encoding="UTF-8"?\>

4.0.0  
  
org.springframework.boot  
spring-boot-starter-parent  
2.2.2.RELEASE  
  
  
com.example  
demo  
0.0.1-SNAPSHOT  
demo  
Demo project for Spring Boot

```
<properties>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <mybatis.plus.version>3.1.1</mybatis.plus.version>
    <aliyun-sdk-oss.version>2.8.2</aliyun-sdk-oss.version>
    <swagger.ui>2.9.2</swagger.ui>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>2.3.28</version>
    </dependency>

    <!-- lombok -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>

    <!--elasticsearch-->
    <dependency>
        <groupId>org.elasticsearch.plugin</groupId>
        <artifactId>x-pack-sql-jdbc</artifactId>
        <version>6.7.1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>2.2.2.RELEASE</version>
    </dependency>

</dependencies>

<build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>elastic.co</id>
        <url>https://artifacts.elastic.co/maven</url>
    </repository>
</repositories>

<profiles>
    <profile>
        <id>dev</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <profileActive>dev</profileActive>
        </properties>
    </profile>
    <profile>
        <id>test</id>
        <properties>
            <profileActive>test</profileActive>
        </properties>
    </profile>
    <profile>
        <id>prod</id>
        <properties>
            <profileActive>prod</profileActive>
        </properties>
    </profile>
</profiles>

```

---

<div class="post-metadata">

**Author:** ![zhu1289303556](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zhu1289303556/32/59439_2.png) [@zhu1289303556](https://discuss.elastic.co/u/zhu1289303556)\
**Post date:** [December 16, 2019, 12:50pm UTC](https://discuss.elastic.co/t/this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown/211894/4 "2019-12-16T12:50:53Z")

</div>

@Andrei_Stefan

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [December 16, 2019, 4:34pm UTC](https://discuss.elastic.co/t/this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown/211894/5 "2019-12-16T16:34:58Z")

</div>

I am not familiar with Spring Boot applications... what cluster does it attempt to access?

- what version of Elasticsearch (server side)?
- is the cluster embedded in this Spring Boot application somehow?
- can you test the JDBC driver **outside** this Spring Boot application?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 16, 2019, 5:08pm UTC](https://discuss.elastic.co/t/this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown/211894/6 "2019-12-16T17:08:18Z")

</div>

When using springboot with  
elasticsearch, you need to be explicit with some transitive dependencies as SpringBoot declares a version 6.4...

Basically you can put this in your `pom.xml`:

```auto
<properties>
  <elasticsearch.version>7.3.0<elasticsearch.version>
</properties>

```

See documentation here: [https://docs.spring.io/spring-boot/docs/current/reference/html/howto-build.html#howto-customize-dependency-versions](https://docs.spring.io/spring-boot/docs/current/reference/html/howto-build.html#howto-customize-dependency-versions)

May be not your problem here but I prefer sharing.

---

<div class="post-metadata">

**Author:** ![zhu1289303556](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zhu1289303556/32/59439_2.png) [@zhu1289303556](https://discuss.elastic.co/u/zhu1289303556)\
**Post date:** [December 17, 2019, 1:40am UTC](https://discuss.elastic.co/t/this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown/211894/7 "2019-12-17T01:40:35Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![zhu1289303556](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zhu1289303556/32/59439_2.png) [@zhu1289303556](https://discuss.elastic.co/u/zhu1289303556)\
**Post date:** [December 17, 2019, 1:43am UTC](https://discuss.elastic.co/t/this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown/211894/8 "2019-12-17T01:43:01Z")

</div>

Elasticsearch is 6.7.1

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 14, 2020, 1:43am UTC](https://discuss.elastic.co/t/this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown/211894/9 "2020-01-14T01:43:02Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
