JDBC Driver From Maven

I have tried following the directions provided in the documentation and yet still can't seem to get the MVN dependency for the new JDBC jar to work. AM I potentially missing something?

              <dependency>
		<groupId>org.elasticsearch.plugin.jdbc</groupId>
		<artifactId>jdbc</artifactId>
		<version>6.3.0</version>
	</dependency>

Did you add artifacts.elastic.co/maven to your repositories list?

Also, just as an FYI, you can get the jar from a regular/non-maven download at https://www.elastic.co/downloads/jdbc-client

Yes. I added the repo:

<repositories>
	<repository>
		<id>apache.snapshots</id>
		<name>Apache Development Snapshot Repository</name>
		<url>https://repository.apache.org/content/repositories/snapshots/</url>
		<releases>
			<enabled>false</enabled>
		</releases>
		<snapshots>
			<enabled>true</enabled>
		</snapshots>
	</repository>
	<repository>
		<id>elastic.co</id>
        <name>Elastic Repository</name>
		<url>https://artifacts.elastic.co/maven</url>
	</repository>

</repositories>

Yes I know I can get them from the site which is fine for some local testing but obviously I don't want to check in jars or have others have to get dependencies when checking out my code

I believe the group and artifact id are wrong. They should be:

		<groupId>org.elasticsearch.plugin</groupId>
		<artifactId>x-pack-sql-jdbc</artifactId>

@gboro54 there's a documentation issue here that we need to fix. Thanks for raising it!

is 6.3.0 still the version number? With the below Im still getting an inability to resolve:

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

</repositories>
<dependencies>
    <dependency>
        <groupId>org.elasticsearch.plugin</groupId>
        <artifactId>x-pack-sql-jdbc</artifactId>
        <version>6.3.0</version>
    </dependency>
</dependencies>

Hi @gboro54,

Sorry for your troubles.
The answer above is correct but the upcoming versions (6.4 and higher).
For 6.3 please use:

 <dependency>
    <groupId>org.elasticsearch.plugin</groupId>
    <artifactId>jdbc</artifactId>
    <version>6.3.0</version>
</dependency>

while from 6.4 and higher (when they will be released), change only the artifactId:

 <dependency>
    <groupId>org.elasticsearch.plugin</groupId>
    <artifactId>x-pack-sql-jdbc</artifactId>
    <version>{future.version}</version>
</dependency>

Sorry for the confusion.
The JDBC jar in 6.4 has been significantly reduced in size and that's why it will have a different name when it will be released.

Hope this helps,

Do you have a working POM for 6.3 I can see? I tried using the first one in your example with the repo set and Im still getting the unresolved dependency. I want to make sure that Im not missing something else in my POM or if its proxy on my network

Hi @gboro54,
I just tested this with the following pom:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>test_jdbc_driver_Maven</groupId>
	<artifactId>test_jdbc_driver_Maven</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<build>
		<sourceDirectory>src</sourceDirectory>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.7.0</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
	
	<dependencies>
		<dependency>
			<groupId>org.elasticsearch.plugin</groupId>
			<artifactId>jdbc</artifactId>
			<version>6.3.0</version>
		</dependency>
	</dependencies>

	<repositories>
		<repository>
			<id>elastic.co</id>
			<name>Elastic Repository</name>
			<url>https://artifacts.elastic.co/maven</url>
		</repository>
	</repositories>
</project>

Side-note: I tested this in Eclipse and, at first, I didn't have set the repository and a warning was present in the Error log. That warning persisted there even after I added the correct repository. These being said, the Dependency Tree in Eclipse was showing the correct list of dependencies for the jdbc jar though. I cleared the Error log, rebuild the project and the warning was gone.

How does this issue manifest itself in your case? Is the jdbc jar actually downloaded?

Thanks. I actually meant to update the thread but the problem was with my maven settings using an internal nexus repo to try and resolve the dependency.

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