Amazon Redshift
Cluster Management Guide

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

For information about how to get your JDBC connection, see Finding Your Cluster Connection String.

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.