PostgreSQL connection timeout

不羁岁月 提交于 2019-12-07 20:44:51

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/22296601/postgresql-connection-timeout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!