mrmatt11
mrmatt11

Reputation: 77

Error connecting SQL Workbench/J to Amazon Athena

I've been having a lot of problems connecting SQL Workbench/J to Amazon Athena through the JDBC connector. Also, the instructions seem to vary between these two help resources:

  1. http://docs.aws.amazon.com/athena/latest/ug/athena-sql-workbench.html
  2. https://s3.amazonaws.com/athena-downloads/drivers/JDBC/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf

Here's the error message:

[Simba]JDBC Connection Refused: [Simba]JDBC Required Connection Key(s): AwsRegion; [Simba]JDBC Optional Connection Key(s): AwsCredentialsProviderArguments, AwsCredentialsProviderClass, BinaryColumnLength, ComplexTypeColumnLength, ConnectTimeout, MaxCatalogNameLength, MaxColumnNameLength, MaxErrorRetry, MaxSchemaNameLength, MaxTableNameLength, ProxyHost, ProxyPort, ProxyPWD, ProxyUID, S3OutputEncOption, Schema, SocketTimeout, StringColumnLength, UseAwsLogger

Upvotes: 0

Views: 7089

Answers (2)

vfrank66
vfrank66

Reputation: 1458

Here is how I have done it

  1. Make sure you have Java8 installed
  2. Download the latest Athena jar
  3. Make a new driver in sql work bench add driver
  4. Add the jdbc connection and username/password enter image description here
  5. location would be location you logged into the account and what setting is in the url url Thus my url is: jdbc:awsathena://athena.us-east-2.amazonaws.com:443
  6. Username= Access Key Id; Password= Secret Access Key
  7. Then do not forget the extended properties! set the s3_staging_dir to the bucket you created for your Athena results, or you will need to look and see what the default bucket is created. This bucket must start with aws-athena-query-results bucket

Update version 2.07

Bucket is now S3OutputLocation not s3_staging_dir: bucket

Upvotes: 3

TallTed
TallTed

Reputation: 9434

The documentation at #1 is deprecated, as you might gather from the different filenames in the two guides. Amazon hasn't fully cleaned up their docs, since switching from their homegrown JDBC driver to the driver they've OEMed from Simba.

You did not provide the JDBC URL you're using, so I cannot provide a specific correction, but the error message you got seems pretty clear -- you apparently didn't build your JDBC URL correctly. It's missing the mandatory AwsRegion setting.

Note the URL syntax from the PDF guide for the JDBC driver you're using --

jdbc:awsathena://AwsRegion=[Region];UID=[AccessKey];PWD=[SecretKey];S3OutputLocation=[Output];[Property1]=[Value1];[Property2]=[Value2];...

Upvotes: 1

Related Questions