1
votes

I am using a generic IDE (JetBrains DataGrip) with Amazon Redshift. When I don't run queries for 20-30 minutes, and return to run a query, I typically get the error message:

[08003] This connection has been closed.

After I get this error message, and immediately try running the query again, the query works. So I gather my first failed attempt reactivates the connection, but then I have to manually rerun the query again to work.

My question: Is there a line of code/query I can insert at the top of my queries to reactivate the connection? I want to avoid this two step manual process when running a query.

Redshift uses: PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.1150

Thanks

1

1 Answers

0
votes

You should really use Amazon's Redshift specific JDBC driver: http://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-connection.html

If you want to use the generic Postgres driver you need to set tcpKeepAlive=true in the Advanced options of the DataGrip connection.