Connecting to your Redshift cluster

You can use a number of tools to connect to your Redshift cluster once its up and running. Most of these tools are PostgreSQL compliant and easily available off the shelf. In this case, we are going to install and use an open source SQL client tool called SQL Workbench/J.

To begin with, you will need to have Java runtime installed on your local workstation. The Java runtime version will have to match the requirements of SQL Workbench/J, otherwise it simply won't work. You can check the version of the installed Java runtime on your local desktop by either locating the Java configuration on the Control Panel or by typing in the following command in a Terminal if you are working with a Linux distribution:

# java --version

In this case, we are using a simple Windows desktop for installing SQL Workbench/J. Download the correct version of the software from here: http://www.sql-workbench.net/downloads.html.

With the software downloaded, the installation is pretty straightforward. Accept the end user license agreement, select a path for the software's installation and that's it! You should have the SQL Workbench/J up and running now:

  1. To connect SQL Workbench/J with your Redshift cluster, you will need your newly created database's JDBC URL. You can copy it by selecting the Connect client option from Redshift's navigation pane and selecting your newly deployed cluster from the Get cluster connection URL section, as shown in the following screenshot:
  1. You will also need to download the correct version of the associated Amazon Redshift JDBC Driver JAR using the same page as well.
  1. Once completed, from the SQL Workbench/J client, select File, followed by the Connect window option.
  2. Here, click on Create a new connection profile to get started. This will pop up a New profile box where you will need to enter a name for this new profile.
  3. Once the profile is created; select the Manage drivers option. This will display the Manage drivers dialog box, as shown in the following screenshot. Select the Amazon Redshift option and provide a suitable Name for your connection driver, as well. Click on the browse icon and select the downloaded Amazon Redshift driver JAR that we downloaded from Redshift a while back. Click on OK to complete the driver settings:
  1. With the driver in place, the final thing left to do is connect to the database and test it. For that, select the newly created Connection profile from SQL Workbench/J and paste the copied database JDBC URL in the URL field as shown. Provide the database's Username and Password as configured during the cluster's setup. Additionally, ensure that the Autocommit option is checked as shown here:
  1. You can also test the connection by selecting the Test option on the SQL Workbench/J screen. Once completed, click OK to establish and open the SQL prompt.

With this step completed, you should have a running Redshift cluster connected to the SQL Workbench/J client as well. The next and final step left for us is to run a few sample queries and test the cluster's functionality, so let's get started with that right away!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset