Has anyone tried connecting AWS Athena from Oracle Data Integrator.
I have been trying this since long but am not able to find the appropriate JDBC connection string.
Steps I have followed from https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html#jdbc-url-format
JDBC string Sample format (which isn't working):
jdbc:awsathena://AwsRegion=[Region];User=[AccessKey];Password=[SecretKey];S3OutputLocation=[Output];
Please can anyone help? Thanks.
This is sorter version of JDBC
I implemented for Athena. This was just POC
and we want to go with AWS SDK
rather then jdbc
though less important here.
package com.poc.aws.athena;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class AthenaJDBC {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Connection connection = null;
Class.forName("com.simba.athena.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:awsathena://AwsRegion=us-east-1;User=EXAMPLEKEY;"
+ "Password=EXAMPLESECRETKYE;S3OutputLocation=s3://example-bucket-name-us-east-1;");
Statement statement = connection.createStatement();
ResultSet queryResults = statement.executeQuery(ExampleConstants.ATHENA_SAMPLE_QUERY);
System.out.println(queryResults.next());
}
}
The only important point here related to url
.
jdbc:awsathena://AwsRegion=us-east-1;User=EXAMPLEKEY;" + "Password=EXAMPLESECRETKYE;S3OutputLocation=s3://example-bucket-name-us-east-1;
.
us-east-1
must be replaced with your actual region like us-west-1
etc EXAMPLEKEY
must be replaced with your AWS Access key
that has Athena access. EXAMPLESECRETKEY
must be replaced with your AWS Secret key
that has Athena access. example-bucket-name-us-east-1
must be replaced with your S3 bucket
that above keys
has write access too. There other keys simba driver support but less important here.
I hope this helps.
Sorry I missed to post answer on this. It all worked fine after configuring a Athena JDBC connection in ODI like below and providing the 4 key values while connecting.
JDBC URL: jdbc:awsathena://athena.eu-west-2.amazonaws.com:443;AWSCredentialsProviderArguments=ACCESSKEYID,SECRETACCESSKEY,SESSIONTOKEN
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.