Datagrip cannot access pg database, pgadmin can

I have a non public aws rds postgres database which I cannot access using datagrip because it gives a ssl error: connection reset. However I can access the database using pgadmin. I am on the same network as the database using a vpn. How can I get datagrip to access the database?

1
17 comments

Eschmeink

Please upload the idea log from Help - Show Log in Files onto our FTP server and provide the upload id when replying to us back:

https://uploads.jetbrains.com/

0

I uploaded the log with id: 2023_08_24_GfnmG7j2MAGe617bU6rWNS

0

SSL Settings: Open DataGrip, navigate to your database configuration settings. Ensure the SSL mode is set correctly (e.g., "Require"). Provide the necessary SSL certificate, key, and root certificate if needed. AWS RDS typically provides a root certificate you can use. Driver Update: Update the PostgreSQL JDBC driver in DataGrip. Sometimes older drivers might have compatibility issues. Connection Timeout: Increase the connection timeout in DataGrip settings. Sometimes VPNs can introduce slight delays. JVM Options: Some users have resolved similar issues by tweaking JVM options for DataGrip. Logs & Diagnostics: Check DataGrip's logs for more detailed error messages. This can give hints on what might be going wrong.  TellTims

0

Thanks for the update, Eschmeink

Do you have SSL configured in your data source properties to connect to RDS database? Do you use the AWS Toolkit plug-in to connect to your database(see below)?

https://plugins.jetbrains.com/plugin/11349-aws-toolkit 

We'd also appreciate if you could send screenshots of your data source properties: General and SSL/SSH tabs in particular. Here's also a config guide

https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/accessing-rds.html

0

I have selected SSL in the data source properties with the (I believe) correct ca-cert for the region. I tried the aws toolkit, but that also did not work.

0

Thanks for the update.

When running the verification with CA, you should normally have 3 pem files specified in the SSL/SSH fields in your data source properties

server-ca.pem
client-cert.pem
client-key.pem

You can also read about the SSL setup here

Do you have the same SSL settings in configured in pgadmin? If so, please let us know how you have it configured there.

0

I tried looking for the client certificates but I don't really see anything from AWS' side on how to get those, or if they even exist at all. The thing with pgadmin is that I did not change a single thing, I just entered the credentials and the host and it worked immediately. So that's why I'm confused that datagrip is having such a hard time connecting. Is there something specific you want to see from my pgadmin configuration?

0
Do you have SSL configured in your database connection in pgadmin? If not, please disable the SSL option and test the connection from your data source properties.

As for the pgadmin settings, please provide screenshots of the connection and parameters tabs
0

Connecting with pgadmin with ssl disabled also works fine.

1

Eschmeink 

Please turn off Use SSL checkbox in SSL / SSH tab and see if the connection succeeds. If not, please upload the idea log file.

0

wtf that worked. I would swear that I tried this immediately. Well thanks regardless.

1

If you can access your AWS RDS PostgreSQL database using pgAdmin but encounter an SSL error ("connection reset") when trying to access it through DataGrip, there are a few steps you can take to troubleshoot and potentially resolve the issue:

Check SSL/TLS Configuration:

  • Verify that the SSL/TLS settings in DataGrip match those used in pgAdmin. This includes checking the SSL mode and certificate settings. Ensure that DataGrip is set to use SSL/TLS if your RDS instance requires it.

Update DataGrip:

  • Ensure that you are using the latest version of DataGrip. Older versions may have compatibility issues with newer SSL/TLS configurations. Upgrading to the latest version can sometimes resolve such issues.

Certificate Trust:

  • Confirm that DataGrip trusts the certificate authority (CA) that issued the SSL certificate for your RDS instance. You may need to add the CA certificate to DataGrip's trust store. The CA certificate can often be downloaded from AWS RDS documentation.

Security Group and Firewall:

  • Ensure that the security group associated with your RDS instance allows incoming connections from the IP address or IP range you are using via VPN. Check for any firewall rules that might be blocking DataGrip's access.

Check VPN Configuration:

  • Double-check your VPN configuration to ensure that it's working correctly and that it allows connections to your AWS RDS instance. Verify that the VPN connection is active and that there are no routing issues.

Advanced SSL/TLS Settings:

  • DataGrip allows for advanced SSL/TLS settings. You can try adjusting these settings to match those in pgAdmin. Specifically, check the SSL root certificate file, SSL certificate file, and SSL key file settings in DataGrip.

Connection String:

  • Review the connection string you are using in DataGrip. Ensure that it specifies the correct SSL mode and options. The connection string should be similar to the one you use in pgAdmin.

Error Logs:

  • Examine the error message in DataGrip for more details. It might provide specific information about the SSL issue. This can help pinpoint the problem.

Restart DataGrip:

  • Sometimes, simply restarting DataGrip can resolve connection issues.

Contact Support:

  • If the issue persists, consider reaching out to DataGrip's support or community forums for assistance. They may be able to provide more specific guidance based on the error message you are encountering.

By following these steps, you should be able to identify and resolve the SSL error issue in DataGrip when connecting to your AWS RDS PostgreSQL database. Remember to keep your software, including DataGrip, up to date to benefit from bug fixes and improvements.

0

Thanks to Eschmeink's answer related to Pgadmin managed to connect to the db, tried the same in Datagrip > advanced > sslmode > disable and voila got connected to DB.

1

Thank you for the helpful information, and rest assured that I will continue to support you guys.

0

To test the connection, please remove the checkmark from the Use SSL option located in the SSL / SSH tab. If this is not the case, please provide the concept log file.

0

Please send the idea log from the "Help - Show Log" section in the Files application to our FTP server. Kindly provide the upload ID when responding to us. 

0

If DataGrip is unable to access a PostgreSQL database while pgAdmin can, there are a few potential reasons and troubleshooting steps you can take:

Check Connection Settings:

  • Verify that the connection settings (host, port, database, username, and password) in DataGrip are correct and match those used in pgAdmin.

Firewall Issues:

  • Check if there are any firewall settings or security groups that might be blocking DataGrip's access to the PostgreSQL server. Ensure that the port used for PostgreSQL (default is 5432) is open.

SSL/TLS Settings:

  • Verify the SSL/TLS settings in DataGrip. If your PostgreSQL server requires an SSL connection, make sure the SSL mode and certificates are configured correctly in DataGrip.

Driver Configuration:

  • Ensure that DataGrip is using the correct JDBC driver for PostgreSQL. You can check and configure this in the DataGrip settings.

Test Connection:

  • Use DataGrip's "Test Connection" feature to check if it can connect to the PostgreSQL database. This can help identify if there are issues with the connection parameters.

Check PostgreSQL Logs:

  • Examine the PostgreSQL server logs for any error messages or connection attempts from DataGrip. This might provide more information about why the connection is failing.

Update DataGrip:

  • Ensure that you are using the latest version of DataGrip. Check for updates and install the latest version if available.

Review pg_hba.conf:

  • In the PostgreSQL server, check the pg_hba.conf file, which controls client authentication. Ensure that it allows connections from the IP address or range used by DataGrip.

Restart PostgreSQL Service:

  • Sometimes, restarting the PostgreSQL service can resolve connectivity issues. Ensure that you perform this during a maintenance window to minimize any impact.

Check for Special Characters:

  • If your password or other connection details contain special characters, try changing the password to something simpler for testing purposes to rule out potential encoding issues.

Proxy or VPN Interference:

  • If you are using a proxy or VPN, it might be interfering with the connection. Try connecting without these services active.

Check DataGrip Logs:

  • Examine DataGrip's logs for any error messages or details about the connection failure. This information can be found in DataGrip's logs or event viewer. EhallPass login
0

Please sign in to leave a comment.