Skip to content

Athena Data Source Connections

To connect to Athena, you must provide an Athena JDBC driver and specify the driver.jar.path and driver.class.name properties for that driver. For more information about Athena's JDBC driver, see https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html, bearing in mind that Okera uses the JDBC driver without the AWS SDK. Store the driver wherever you prefer, but in a location that is accessible to Okera. Specify the path to the driver in driver.jar.path and the class name for the driver in driver.class.name. If you are creating an Athena connection in the Okera UI, these properties can be specified in the Driver file path and Driver class name fields.

Okera tries to download the JAR files on the fly for the first time from the valid driver.jar.path. If you are in S3, this path/file should have appropriate IAM credentials for Okera to connect and download the file. For any other URI, this file should be downloadable.

Here is a programmatic example for connecting to Athena.

CREATE DATACONNECTION athena_connection CXNPROPERTIES
(
  'connection_type'='JDBC',
  'jdbc_driver'='awsathena',
  'host'='athena.<region>.amazonaws.com',
  'port'='<port, typically 443>',
  'user_key'='awssm://<my-username>',
  'password_key'='awssm://<my-password>',
  'jdbc.schema.name'='<Athena database name to connect to>',
  'connection_properties'='{"AwsRegion":"<region>", "driver.jar.path":"s3://okera-jdbc-test/drivers/AthenaJDBC42.jar", "driver.class.name":"com.simba.athena.jdbc.Driver", "S3OutputLocation":"<The s3 default output path, can be found in Athena settings>"}'
);

Note: For awsathena, the jdbc.schema.name is the actual Athena database name, following the Athena naming conventions.

Starting with Athena 2.0.5, the Athena JDBC connector uses the result set streaming API to improve its performance when fetching query results. To use this Athena feature:

  1. Include and allow the athena:GetQueryResultsStream action in your IAM policy statement. For details on managing Athena IAM policies, see https://docs.aws.amazon.com/athena/latest/ug/access.html.

  2. If you are connecting to Athena through a proxy server, make sure that the proxy server does not block port 444. The result set streaming API uses port 444 on the Athena server for outbound communications.