Tuesday, November 01, 2022

Connecting to AWS Athena using JDBC (Dbeaver)

A quick post on setting up a connection to Athena with OKTA using JDBC. The SQL client I am using is DBeaver, but any other tool could be used.

  1. Figure out your connection string.
    replace the highlighted sections with values that are valid for your org.
    jdbc:awsathena://AwsRegion=us-west-2;S3OutputLocation=s3://my-athena-results-bucket/results-folder/;AwsCredentialsProviderClass=com.simba.athena.iamsupport.plugin.OktaCredentialsProvider;user={user};password={password};idp_host=mycompany.okta.com;App_ID=0aosd2asadsdsdsd/123;SSL_Insecure=true;
  2. In Dbeaver, click on "New Connection", which will bring up the "Connect to a database" dialog. Search for Athena and click next.
     
  3. Enter your username & password. For my org, I just had to enter my WindowsNT id without the domain, but it might be different for your org.
  4. Click on the button Driver Settings
  5. Replace the "URL Template" with the value from step 1 on this page (connection string)

    Click OK.
  6. Test your connection.
That should make it work!


Creating an ODBC connection is very similar: