Gradle / Maven Dependency for Redshift JDBC Driver

I downloaded RedshiftJDBC41-1.1.17.1007.jar to use com.amazon.redshift.jdbc41.Driver for some of the POC Redshift work I am doing and manually adding it to my classpath.

I would like to include it in our assembly, but I cannot find an example of the dependency name so that it can insert my build.gradle file or find it in the Maven repository. Any tips? (Note that I'm only looking for reddsh jdbc, not the old postgres-redshift driver).

+10
maven amazon-redshift gradle
source share
7 answers

Redshift JDBC drivers are now available on maven repo. Take a look at http://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-connection-with-maven.html

+12
source share

The first thing to understand is that the amazon documentation tells you to download the version of the v4 driver JAR file. If you downloaded the driver, you received the v4X driver version, so your code should be:

 Class.forName("com.amazon.redshift.jdbc41.Driver"); 

NOT

 Class.forName("com.amazon.redshift.jdbc4.Driver"); 

Note the addition of the version number in the first example!

The jar driver is here:

http://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-connection.html

Amazon doesn't publish to Maven (Come on Amazon WTF?), So you need to import the downloadable jar. The Maven import command (for JDBC) is as follows:

mvn install: install-file -Dfile =. / RedshiftJDBC41-1.1.10.1010.jar -DgroupId = com.amazon -DartifactId = redshift.jdbc41 -Dversion = 1.1.10.1010 -Dpackaging = jar -DgeneratePom = true

The Maven dependency looks like this (note that artificatID and Version should be what you gave it in the mvn command above. If the driver was updated, then the mvn command and the dependency fields should change):

  <dependency> <groupId>com.amazon</groupId> <artifactId>redshift.jdbc41</artifactId> <version>1.1.10.1010</version> </dependency> 
+13
source share

The simple reason they are not uploaded to a public repo is: Licensing.

I spent many hours because of this. An hour to find it in the maven repo and find the reason (reading about people's comments, etc.). An hour to upload it to the internal repository. Then figure out how to use it with AWS Lambda.

Amazon does not publish the RedShift JDBC driver in any public repository due to some silly licensing / legal issues. They use open source LOT projects, but they don’t tell the community anything. This particular redshift driver is an example.

His client-oriented company, but still there are some legal entities that do not do their job properly. By the way, I'm a former Amazon employee.

+4
source share

Amazon does not publish to Maven, so you need to import a downloadable jar.

Gradle

  • download driver 2.create libs folder in the project root directory

  • add to build.gradle

     repositories { flatDir { dirs 'libs'} } dependencies { compile name: 'RedshiftJDBC42-1.2.1.1001' } 

JAVA EXAMPLE

Follow here

+1
source share

This artifact seems to be unavailable in any Maven repository. I managed to find the JDBC driver with redshift for version 1.1.2.0002 on this GitHub repository , but this is not the version you are looking for.

It would be best to manually add this dependency using:

 mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=jar -DgeneratePom=true 
0
source share

The easiest way is to add the Amazon Redshift repository to the Gradle build file, and then include the dependency as follows.

build.gradle:

 group 'com.yourcompany' version '1.0-SNAPSHOT' repositories { mavenCentral() maven { url 'http://redshift-maven-repository.s3-website-us-east-1.amazonaws.com/release' } } dependencies { compile group: 'com.amazon.redshift', name: 'redshift-jdbc42', version: '1.2.16.1027' } 
0
source share

add

 <repositories> <repository> <id>redshift</id> <url>https://s3.amazonaws.com/redshift-maven-repository/release</url> </repository> </repositories> 

then the version you want.

 <dependency> <groupId>com.amazon.redshift</groupId> <artifactId>redshift-jdbc42</artifactId> <version>1.2.10.1009</version> </dependency> 
0
source share

All Articles