I've downloaded the RedshiftJDBC41-1.1.17.1007.jar to use the com.amazon.redshift.jdbc41.Driver
for some Redshift POC work that I'm doing, and have been adding it manually to my classpath.
I'd like to now incorporate it into our build, but I can't seem to find an example of a dependency name for it to put in my build.gradle
file or find it in a Maven repo. Any tips? (Note, I'm looking for redshift jdbc only, not the older postgres-redshift driver).
Redshift JDBC drivers are now available on maven repo. Look at http://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-connection-with-maven.html
If the link doesn't work, navigate to Querying a Database -> Connecting to a Cluster Using SQL Client Tools -> Configuring Connections in Amazon Redshift -> Configuring a JDBC Connection
Add the redshift repository
<repositories>
<repository>
<id>redshift</id>
<url>http://redshift-maven-repository.s3-website-us-east-1.amazonaws.com/release</url>
</repository>
</repositories>
And then add the dependency, like
<dependency>
<groupId>com.amazon.redshift</groupId>
<artifactId>redshift-jdbc42</artifactId>
<version>1.2.41.1065</version>
</dependency>
But there are many variants on the driver, so you should visit the page to read more and pick the one you need.
Simple reason why they don't upload to public repo: Licensing.
I wasted many hours because of it. An hour to figure out to find it in maven repo and finding the reason (reading about people comments etc). An hour to upload it to internal repository. Then figuring out how to use it with AWS Lambda.
Amazon doesn't publish RedShift JDBC driver to any public repository, due to some stupid licensing/legal issues. They use LOT of open source projects, but don't contribute anything back to community. Just this redshift driver is an example.
Its a customer centric company, but still there are some legal folks who don't do their work properly. Btw, I'm an ex-employee of amazon.
The first thing to realize is that amazon documentation tells you to load the v4 version of the driver JAR file. If you downloaded the driver you got a v4X version of the driver 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 driver jar is here:
http://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-connection.html
Amazon does not publish to Maven (Come on Amazon WTF?) so you have to import the jar you download. The Maven import command (for JDBC) looks like this:
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 the artificatID and Version should be what you gave it in the mvn command above. If the driver has been updated, then the mvn command and the dependency fields have to change):
<dependency>
<groupId>com.amazon</groupId>
<artifactId>redshift.jdbc41</artifactId>
<version>1.1.10.1010</version>
</dependency>
Amazon does not publish to Maven so you have to import the jar you download.
Gradle
download driver 2.create libs folder on the root directory of project
add in the build.gradle
repositories {
flatDir { dirs 'libs'}
}
dependencies {
compile name: 'RedshiftJDBC42-1.2.1.1001'
}
JAVA USAGE EXAMPLE
Follow here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With