自学内容网 自学内容网

ODBC连接PostgreSQL数据库后,网卡DOWN后,客户端进程阻塞问题解决方法

问题现象:数据库客户端进程数据库连接成功后,再把跟数据库交互的网卡down掉,客户端进程就会阻塞,无法进行其他处理。该问题跟TCP keepalive机制有关。

可以在odbc.ini文件中增加相应的属性来解决,在odbc.ini 增加如下内容:

pqopt = keepalives=1 keepalives_idle=5 keepalives_count=1 keepalives_interval=1

 odbc.ini:

[sles12-1]
Description = PostgreSQL connection to rtpdb
Driver = PostgreSQL
Database = rtpdb
pqopt = keepalives=1 keepalives_idle=5 keepalives_count=1 keepalives_interval=1
Servername = sles12-1
Username =
Password =
Port = 5432
Protocol = 7.4+
ReadOnly = No
RowVersioning = No
ShowSystemTables = No

参考链接:Thread: ODBC cliens is hanging if network connection is broken : Postgres Professional


原文地址:https://blog.csdn.net/sinat_25376319/article/details/143946793

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!