Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connection to SQL Workbench/J gets disconnected frequently

The connection to SQL Workbench/J gets disconnected very frequently. Where can I change the settings so that it does not lose the connections for atleast an hour.

Thanks

like image 895
Amy123 Avatar asked Mar 09 '16 20:03

Amy123


2 Answers

This works for me with using PostgreSQL...

  1. Go to Connection Window
  2. Select the connection you want to keep alive
  3. Click the "Connect scripts" button
  4. Write "Select 1" in the third box titled "Statement to keep connection alive"
  5. Write "1m" in fourth box titled "Idle time"

SQL Workbench/J (screenshot)

like image 99
amz Avatar answered Dec 21 '22 03:12

amz


What OS are you using and what type of database are you connecting to?

I had the same issue using Windows connecting to a Redshift database. I followed the instructions on Amazon doing the following:

  • Edit (or otherwise create if not already existing in my case) the values for the following registry settings under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters:

    • KeepAliveTime: 30000
    • KeepAliveInterval: 1000
    • TcpMaxDataRetransmissions: 10

Reference here: http://docs.aws.amazon.com/redshift/latest/mgmt/connecting-firewall-guidance.html

like image 27
crazy8 Avatar answered Dec 21 '22 03:12

crazy8