Menu
Amazon Redshift
Management Guide (API Version 2012-12-01)

Configure a JDBC Connection

You can use a JDBC connection to connect to your Amazon Redshift cluster from many third-party SQL client tools. To do this, you need to download a JDBC driver. Follow the steps in this section if you want to use a JDBC connection.

Download the Amazon Redshift JDBC Driver

Amazon Redshift offers drivers for tools that are compatible with either the JDBC 4.2 API, JDBC 4.1 API, or JDBC 4.0 API. For information about the functionality supported by these drivers, go to the Amazon Redshift JDBC Driver Release Notes.

Amazon Redshift JDBC drivers version 1.2.7.1003 and later support database authentication using AWS Identity and Access Management (IAM) credentials or identity provider (IdP) credentials. For more information, see Using IAM Authentication to Generate Database User Credentials.Amazon Redshift JDBC drivers version 1.2.7.1003 and later support database authentication using AWS Identity and Access Management (IAM) credentials or identity provider (IdP) credentials. For more information, see Using IAM Authentication to Generate Database User Credentials.

Download one of the following, depending on the version of the JDBC API that your SQL client tool or application uses. If you're not sure, download the latest version of the JDBC 4.2 API driver.

Note

For driver class name, use either com.amazon.redshift.jdbc.Driver or the version-specific class name listed with the driver in the list following.

The standard Amazon Redshift JDBC drivers include the AWS SDK that is required to use IAM database authentication. We recommend using the standard drivers unless the size of the driver files is an issue for your application. If you need smaller driver files and you do not use IAM database authentication, or if you already have AWS SDK for Java 1.11. 118 or later in your Java class path, then download one of the following drivers.

Then download and review the Amazon Redshift JDBC Driver License Agreement.

If you need to distribute these drivers to your customers or other third parties, please send email to redshift-pm@amazon.com to arrange an appropriate license.

Previous JDBC Driver Versions

Download a previous version of the Amazon Redshift JDBC driver only if your tool requires a specific version of the driver. For information about the functionality supported in previous versions of the drivers, download Amazon Redshift JDBC Driver Release Notes.

Note

For authentication using AWS Identity and Access Management (IAM) credentials or identity provider (IdP) credentials, use Amazon Redshift JDBC driver version 1.2.7.1003 or later.

These are previous JDBC 4.2–compatible drivers:

These are previous JDBC 4.1–compatible drivers:

These are previous JDBC 4.0–compatible drivers:

Obtain the JDBC URL

Before you can connect to your Amazon Redshift cluster from a SQL client tool, you need to know the JDBC URL of your cluster. The JDBC URL has the following format:

jdbc:redshift://endpoint:port/database

Note

A JDBC URL specified with the former format of jdbc:postgresql://endpoint:port/database will still work.

Field Value
jdbc The protocol for the connection.
redshift The subprotocol that specifies to use the Amazon Redshift driver to connect to the database.
endpoint The endpoint of the Amazon Redshift cluster.
port The port number that you specified when you launched the cluster. If you have a firewall, ensure that this port is open for you to use.
database The database that you created for your cluster.

The following is an example JDBC URL: jdbc:redshift://examplecluster.abc123xyz789.us-west-2.redshift.amazonaws.com:5439/dev

To obtain your JDBC URL

  1. Sign in to the AWS Management Console and open the Amazon Redshift console at https://console.aws.amazon.com/redshift/.

  2. At top right, select the region in which you created your cluster.

    If you followed the Amazon Redshift Getting Started, select US West (Oregon).

  3. In the left navigation pane, click Clusters, and then click your cluster.

    If you followed the Amazon Redshift Getting Started, click examplecluster.

  4. On the Configuration tab, under Cluster Database Properties, copy the JDBC URL of the cluster.

If the client computer fails to connect to the database, you can troubleshoot possible issues. For more information, see Troubleshooting Connection Issues in Amazon Redshift.