PostgreSQL连接超时 [英] PostgreSQL connection timeout
问题描述
我正在将桌面应用程序与PostgreSQL数据库服务器一起使用。当我连续10到20分钟不使用应用程序时,数据库连接已断开。我正在使用 PostgresqlJDBC 进行数据库连接。
请帮助我解决数据库连接超时问题。
谢谢。
声音听起来像是通过有状态连接跟踪路由器/防火墙连接的,短连接跟踪超时。听起来好像您需要启用keepalive。
看看 tcp_keepalives_interval
和 tcp_keepalives_idle
参数。 p>
您还可以在JDBC驱动程序中请求客户端的keepalive;请参阅pgJDBC文档。
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.
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.
这篇关于PostgreSQL连接超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!