没有为jdbc找到合适的驱动程序:amazonaws [英] No suitable driver found for jdbc:amazonaws
问题描述
我正在尝试使用JDBC连接到amazon athena。由于我没有在maven上找到 AthenaDriver 存储库,我自己在 github上。基本上我正在做的是:
I'm trying to connect to amazon athena using JDBC. As I didn't find the AthenaDriver repository on maven, I created it myself on my github. Basically what I'm doing is this:
pom.xml:
<repository>
<id>mvn-rep</id>
<name>maven repository</name>
<url>https://github.com/raphael-psr/maven-repository/raw/master/</url>
</repository>
<dependency>
<groupId>com.amazonaws.athena.jdbc</groupId>
<artifactId>AthenaJDBC41</artifactId>
<version>1.1.0</version>
</dependency>
java:
class.forName("com.amazonaws.athena.jdbc.AthenaDriver");
Properties properties = new Properties();
properties.setProperty("user", user);
properties.setProperty("password", password);
properties.setProperty("aws_credentials_provider_class", "amazon.AmazonCredentialsProvider");
Connection connection = DriverManager.getConnection("jdbc:awsathena://athena." + region + ".amazonaws.com:443", properties);
引发异常:
java.sql.SQLException:没有为jdbc找到合适的驱动程序:amazonaws://athena.us-east-1.amazonaws.com:443
java.sql.SQLException: No suitable driver found for jdbc:amazonaws://athena.us-east-1.amazonaws.com:443
任何人都知道它可能是什么?
Anyone knows what it might be?
推荐答案
从 https://s3.amazonaws.com/athena-downloads/drivers/AthenaJDBC41-1.1。 0.jar
将jar添加到您自己的maven存储库
Add the jar to your own maven repository
mvn install:install-file -Dfile=/home/sumit/Downloads/AthenaJDBC41-1.1.0.jar -DgroupId=com.amazonaws.athena.jdbc -DartifactId=athenaJDBC -Dversion=1.1.0 -Dpackaging=jar
将 -Dfile 值更改为下载的jar路径。
如果需要,请更新 -Dversion 。
change -Dfile value to your downloaded jar path. If required update -Dversion.
为您的pom.xml添加相关性
Add dependency to your pom.xml
<dependency>
<groupId>com.amazonaws.athena.jdbc</groupId>
<artifactId>athenaJDBC</artifactId>
<version>1.1.0</version>
</dependency>
这篇关于没有为jdbc找到合适的驱动程序:amazonaws的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!