I'm using the latest version of IntelliJ and I've just created a cluster in Amazon Redshift. How do I connect IntelliJ to Redshift so that I can query it from my favorite IDE?
View |Tool Windows | Database
View |Tool Windows | Database
+
) and select "Database Driver": Uncheck "JDBC drivers", and add a jdbc driver, select a class from the dropdown and select a PostgreSQL dialect:
6.Add a new connection, and use this datasource for your connection: ( + | Data Source | RedShift
).
7.Set URL templates:
jdbc:redshift://[{host::localhost}[:{port::5439}]][/{database::postgres}?][\\?<&,user={user:param},password={password:param},{:identifier}={:param}>]
jdbc:redshift://\\[{host:ipv6:\\:\\:1}\\][:{port::5439}][/{database::postgres}?][\\?<&,user={user:param},password={password:param},{:identifier}={:param}>]
jdbc:redshift:{database::postgres}[\\?<&,user={user:param},password={password:param},{:identifier}={:param}>]
You can connect IntelliJ to Redshift by the using the JDBC Driver supplied by Amazon. In the Redshift Console, go to "Connect Client" to get the driver.
Then, in the IntelliJ Data Source window, add the JAR as a Driver file, and use the following settings:
Common Pitfalls:
For a more detailed guide, see this blog post: Connecting IntelliJ to Redshift
Note: There is no native Redshift support in IntelliJ yet. IntelliJ Issue DBE-1459
Update for 2019: I've just created a PostgreSQL connection and then filled the usual Redshift settings (don't forget port: 5439), no need to download Amazon's JDBC driver.
Only little issue is that the syntax check doesn't know Redshift specificities such as AS
and some functions, but queries execute correctly.
Update for 2020 : PyCharm (and possibly all other JetBrains IDEs) now supports connecting to Redshift through IAM AWS credentials without manual driver installation .
Here are the detailed setup instructions:
Grant a redshift:GetClusterCredentials
permission to your AWS user. Either create and attach a new policy ( docs ) or use an existing one such as AmazonRedshiftFullAccess
(not recommended: too permissive).
Create an AWS access key (access key id + secret access key pair) for your user ( docs ).
Create a text configuration file ~/.aws/credentials
(no extension) with the following content ( docs ):
[default] # arbitrary profile name, will be used later
region = <your region>
aws_access_key_id = <your access key id> # created on the previous step
aws_secret_access_key = <your secret access key>
IAM cluster/region
(right under the «General» tab of the connection settings window).AWS Profile
{your AWS login}
default
or the one you have used in credentials file.
AccessKeyID
/ SecretAccessKey
connection settings on the «Advanced» tab but it did not work for me (due to NullPointerException if Profile field is empty).{your database}
, choose an existing one to not face non descriptive errors from the driver. {your region}
{cluster name}
, get it from Redshift AWS console . AutoCreate = true
(literal lowercase true
as the setting value). This will automatically create a new database user with your AWS login.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.