Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL connection timeout

I am using a desktop application with PostgreSQL database server. When I am not using application for 10 to 20 minutes continuously, the database connection is dropped. And I am using PostgresqlJDBC for database connection.

Please help me on this to database connection time out.

Thanks.

like image 340
Prakki Avatar asked Oct 18 '25 03:10

Prakki


1 Answers

Sounds like you are connected via a stateful connection tracking router/firewall that has a short connection tracking timeout. Sounds like you need to enable keepalives.

Take a look at the tcp_keepalives_interval and tcp_keepalives_idle parameters.

You can also request keepalives client-side in the JDBC driver; see the pgJDBC docs.

like image 85
Craig Ringer Avatar answered Oct 19 '25 17:10

Craig Ringer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!