Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Amazon Redshift Cookbook

You're reading from   Amazon Redshift Cookbook Recipes for building modern data warehousing solutions

Arrow left icon
Product type Paperback
Published in Apr 2025
Publisher Packt
ISBN-13 9781836206910
Length 468 pages
Edition 2nd Edition
Arrow right icon
Authors (3):
Arrow left icon
Shruti Worlikar Shruti Worlikar
Author Profile Icon Shruti Worlikar
Shruti Worlikar
 Patel Patel
Author Profile Icon Patel
Patel
Anusha Challa Anusha Challa
Author Profile Icon Anusha Challa
Anusha Challa
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Getting Started with Amazon Redshift 2. Data Management FREE CHAPTER 3. Loading and Unloading Data 4. Zero-ETL Ingestions 5. Scalable Data Orchestration for Automation 6. Platform Authorization and Security 7. Data Authorization and Security 8. Performance Optimization 9. Cost Optimization 10. Lakehouse Architecture 11. Data Sharing with Amazon Redshift 12. Generative AI and ML with Amazon Redshift 13. Other Books You May Enjoy
14. Index
Appendix

Connecting to Amazon Redshift using SQL Workbench/J client

There are multiple ways to connect to the Amazon Redshift data warehouse, but one of the most popular options is to connect using a UI based tool. SQL Workbench/J is a free cross-platform SQL query tool, which can be used to connect using your own local client.

Getting ready

To complete this recipe, you will need:

  • An Amazon Redshift data warehouse (serverless or provisioned cluster) and its login credentials (username and password).
  • Install SQL Workbench/J (https://www.sql-workbench.eu/manual/install.html).
  • Download Amazon Redshift Driver. Visit https://docs.aws.amazon.com/redshift/latest/mgmt/configuring-connections.html to download the latest driver version.
  • Modify the security group attached to the Amazon Redshift cluster to allow connection from a local client.
  • For provisioned clusters, navigate to Amazon Redshift | Provisioned clusters dashboard | myredshiftcluster | General information to find the JDBC/ODBC URL to connect to an Amazon Redshift provisioned cluster.
  • For Serverless, navigate to Amazon Redshift | Redshift Serverless | myredshiftwg | General information to find the JDBC/ODBC URL to connect to Amazon Redshift serverless clusters.

How to do it…

The following steps will enable you to connect using the SQL Workbench/J client tool from your computer:

  1. Open SQL Workbench/J by double-clicking on the SQLWorkbench.exe (on Windows) or SQLWorkbenchJ application (on Mac).
  2. In the SQL Workbench/J menu, select File and then select Connect window.
  3. Select Create a new connection profile.
  4. In the New profile box, choose any profile name, such as examplecluster_jdbc.
  5. Select Manage Drivers. The Manage Drivers dialog will open; select Amazon Redshift:
Figure 1.8 – SQL Workbench/J Manage drivers box

Figure 1.8 – SQL Workbench/J Manage drivers box

  1. Select the folder icon adjacent to the Library box, browse and point it to the Amazon Redshift driver location, and then select Choose:
Figure 1.9 – SQL Workbench/J to select Amazon Redshift driver

Figure 1.9 – SQL Workbench/J to select Amazon Redshift driver

  1. To set up the profile for the Amazon Redshift connection, enter the following details:
    1. In the Driver box, select the Amazon Redshift drive.
    2. In URL, paste the Amazon Redshift cluster JDBC URL obtained previously.
    3. In Username, enter the username (or the master user name) associated with the cluster.
    4. In Password, provide the password associated with the username.
    5. Checkmark the Autocommit box.
    6. Select the Save profile list icon, as shown in the following screenshot, and select OK:
    A screenshot of a computer

AI-generated content may be incorrect.

    Figure 1.10 – Amazon Redshift Connection Profile

  2. After setting up the JDBC connection, you can use the query to ensure you are connected to the Amazon Redshift cluster:
    select * from information_schema.tables;
    

A list of records will appear in the Results tab if the connection was successful:

Figure 1.11 – Sample query output from SQL Workbench/J

Figure 1.11 – Sample query output from SQL Workbench/J

lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Amazon Redshift Cookbook
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon