Connect Without Using the Server Certificate in
Java
If you do not use the server certificate, you can still connect to your Amazon Redshift cluster; however,
your client will not be able to validate that it is connecting to an Amazon Redshift cluster. If you don't use
the certificate, you can still connect by using SSL.
To connect without using a server certificate
• Specify the following properties in your connection string.
property name: sslfactory
property value: org.postgresql.ssl.NonValidatingFactory
For example, in SQL Workbench/J, you can specify the connection string as follows:
jdbc:postgresql://CLUSTERNFO.redshift.amazonaws.com:PORT/DB
NAME?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
Where:
• CLUSTERINFO is the specific connectivity information for your cluster, e.g.,
examplecluster.copoarqsqlsn.us-east-1.
• PORT is the port you specified when you created the cluster, e.g., 5439.
• DBNAME is the name of the database you specified when you created the cluster, e.g., mydb.
In Java code you can specify the connection string as follows:
Connection conn = null;
Properties props = new Properties();
props.setProperty("ssl", "true");
props.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory");
conn = DriverManager.getConnection(<jdbc-connection-string>, props);
Connect to Your Cluster Programmatically
Topics
• Connecting to a Cluster by Using Java (p. 107)
• Connecting to a Cluster by Using .NET (p. 110)
This section explains how to connect to your cluster programmatically. If you are using an application like
SQL Workbench/J that manages your client connections for you, then you can skip this section.
Connecting to a Cluster by Using Java
When you use Java to programmatically connect to your cluster, you can do so with or without server
authentication. If you plan to use server authentication, follow the instructions in Connect to Your Cluster
API Version 2012-12-01
107
Amazon Redshift Management Guide
Connect Without Using the Server Certificate in Java