Using Athena with the JDBC driver - Amazon Athena

Using Athena with the JDBC driver

You can use a JDBC connection to connect Athena to business intelligence tools and other applications, such as SQL workbench. To do this, use the Amazon S3 links on this page to download, install, and configure the Athena JDBC driver. For information about building the JDBC connection URL, see the downloadable JDBC driver installation and configuration guide. For permissions information, see Access through JDBC and ODBC connections. Starting with version 2.0.24, two versions of the driver are available: one that includes the AWS SDK, and one that does not.

Important

When you use the JDBC driver, be sure to note the following requirements:

  • Open port 444 – Keep port 444, which Athena uses to stream query results, open to outbound traffic. When you use a PrivateLink endpoint to connect to Athena, ensure that the security group attached to the PrivateLink endpoint is open to inbound traffic on port 444. If port 444 is blocked, you may receive the error message [Simba][AthenaJDBC](100123) An error has occurred. Exception during column initialization.

  • athena:GetQueryResultsStream policy – Add the athena:GetQueryResultsStream policy action to the IAM principals that use the JDBC driver. This policy action is not exposed directly with the API. It is used only with the ODBC and JDBC drivers as part of streaming results support. For an example policy, see AWS managed policy: AWSQuicksightAthenaAccess.

  • 4.1 drivers – Driver support for JDBC version 4.1 is discontinued, and further updates will not be released. If you are using a JDBC 4.1 driver, migration to the 4.2 driver is highly recommended. Links to the 4.1 JDBC version will be removed starting in 2023.

JDBC driver with AWS SDK

The JDBC driver version 2.0.34 complies with the JDBC API 4.1 and 4.2 data standards. For information about checking the version of Java Runtime Environment (JRE) that you use, see the Java documentation. The JRE version depends on the version of the JDBC API that you use with the driver.

Download the driver that matches your version of the JDK and the JDBC data standards:

The following .zip file download contains the .jar files for JDBC 4.1 and 4.2 and includes the AWS SDK.

JDBC driver without AWS SDK

The JDBC driver version 2.0.34 complies with the JDBC API 4.1 and 4.2 data standards. For information about checking the version of Java Runtime Environment (JRE) that you use, see the Java documentation. The JRE version depends on the version of the JDBC API that you use with the driver.

Download the driver that matches your version of the JDK and the JDBC data standards. These files do not include the AWS SDK:

The following .zip file download contains the .jar files for JDBC 4.1 and 4.2. It does not include the AWS SDK.

JDBC driver release notes, license agreement, and notices

After you download the version you need, read the release notes, and review the License Agreement and Notices.

JDBC driver documentation

Download the following documentation for the driver:

JDBC driver notes

Using the JDBC driver for multiple data catalogs

To use the JDBC driver for multiple data catalogs with Athena (for example, when using an external Hive metastore or federated queries), include MetadataRetrievalMethod=ProxyAPI in your JDBC connection string.