Mehaboob Khan
Mehaboob Khan

Reputation: 353

Unable to connect to AWS Athena Workgroup using JDBC connection?

I am using JDBC to connect to Athena for a specific Workgroup. But it is by default redirecting to the primary workgroup Below is the code snippet

Properties info = new Properties();
        info.put("user", "access-key");
        info.put("password", "secrect-access-key");
        info.put("WorkGroup","test");
        info.put("schema", "testschema");
        info.put("s3_staging_dir", "s3://bucket/athena/temp");
info.put("aws_credentials_provider_class","com.amazonaws.auth.DefaultAWSCredentialsProviderChain");
        Class.forName("com.simba.athena.jdbc.Driver");
        Connection connection = DriverManager.getConnection("jdbc:awsathena://athena.<region>.amazonaws.com:443/", info);

As you can see I am using "Workgroup" as the key for the properties. I also tried "workgroup", "work-group", "WorkGroup". It is not able to redirect to the specified Workgroup. Always going to the default one i.e primary workgroup.

Kindly help. Thanks

Upvotes: 1

Views: 1966

Answers (2)

Prabhakar Reddy
Prabhakar Reddy

Reputation: 5124

You need to Override Client-Side Settings in workgroup.Enable below setting and rerun the query via JDBC. enter image description here

Check this doc for more information.

Upvotes: 0

stevelo
stevelo

Reputation: 114

If you look at the release notes of Athena JDBC, the workgroup support is from v2.0.7.

If you jar is below this version, it will not work. Try to upgrade the library to 2.0.7 or above

Upvotes: 1

Related Questions