Amazon Redshift
Cluster Management Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

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.

For installation and configuration information, see Amazon Redshift JDBC Driver Installation and Configuration Guide.

JDBC drivers version 1.2.27.1051 and later support Amazon Redshift stored procedures. For more information, see Amazon Redshift Database Developer Guide Creating Stored Procedures.

JDBC drivers version 1.2.8.1005 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.

If you use the Amazon Redshift JDBC driver for database authentication, you must have AWS SDK for Java 1.11.118 or later in your Java class path. If you don't have AWS SDK for Java installed, you can use a driver that includes the AWS SDK. For more information, see Previous JDBC Driver Versions With the AWS SDK for Java

Important

We strongly recommend using an Amazon Redshift JDBC driver that doesn't include the AWS SDK if possible. The drivers in the following list don't include the AWS SDK.

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.

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

If your tool requires a specific previous version of a driver, see Previous JDBC Driver Versions.

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.

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.