如何配置DataGrip通过SSL连接Redshift?连接失败问题咨询
Fixing DataGrip SSL Connection Failures to Redshift (Works in SQLWorkbench/J)
Yep, I’ve encountered multiple users facing this exact discrepancy—where SQLWorkbench/J connects to Redshift over SSL flawlessly with the latest driver, but DataGrip throws errors even after enabling "Use SSL" and adding URL parameters. Here are the most effective fixes that have resolved this for most folks:
1. Ensure You’re Using the Official Redshift Driver
- Don’t rely on DataGrip’s default PostgreSQL driver for Redshift. Even though Redshift is PostgreSQL-based, its SSL handling has subtle differences.
- Go to your connection settings > Driver tab, select
Amazon Redshiftfrom the dropdown, and make sure it’s using the latest official JDBC driver (download it via DataGrip if needed).
2. Fix URL Parameter Format & Avoid Conflicting Settings
- The
&in your URL is an HTML entity—DataGrip’s URL input expects raw&instead. Update your URL to:jdbc:redshift://your-cluster-url:5439/your-db?ssl=true&sslfactory=com.amazon.redshift.ssl.NonValidatingFactory - Don’t enable both the "Use SSL" checkbox and manual URL SSL parameters. Pick one approach: either trust the checkbox to set the right parameters, or disable it and handle everything via the URL.
3. Check Driver-DataGrip Version Compatibility
- Newer Redshift JDBC drivers (2.2.x+) sometimes have compatibility issues with older DataGrip versions (pre-2023.x). Try:
- Downgrading the Redshift driver to 2.1.0.10 (a stable version that works across most DataGrip releases)
- Or upgrading DataGrip to the latest stable release to match the newest driver
4. Import Redshift’s Root Certificate into DataGrip
- DataGrip uses the system’s certificate store by default, while SQLWorkbench/J may use its own. To fix certificate validation failures:
- Download Redshift’s root certificate (e.g.,
rs-ca-2019-root.pem) - Go to
File > Settings > Tools > Server Certificates - Click the
+button, enter your Redshift cluster’s hostname, and select the downloaded certificate file. Save the settings and retry the connection.
- Download Redshift’s root certificate (e.g.,
5. Enable Debug Logs to Pinpoint Exact Errors
- If the above steps don’t work, enable JDBC logging in DataGrip to see what’s going wrong:
- Navigate to
File > Settings > Appearance & Behavior > System Settings > Debug Log Settings - Add
com.intellij.database.remote.jdbcto the list - Attempt the connection again, then go to
Help > Show Log in Explorerto view the logs. Look for SSL-related errors (e.g.,SSLHandshakeException, certificate validation failures) to narrow down the issue.
- Navigate to
Bonus: Try PostgreSQL Driver Compatibility Mode
- If all else fails, switch your connection’s driver type to PostgreSQL (instead of Redshift), then configure SSL manually:
- Enable "Use SSL"
- Set the
sslfactoryparameter toorg.postgresql.ssl.NonValidatingFactory(in the driver properties tab) - This fallback works because Redshift’s protocol is close enough to PostgreSQL’s for SSL connections in many cases.
内容的提问来源于stack exchange,提问作者Dan Kowalczyk
相关产品推荐
相关产品推荐

