From: Inoue, Hiroshi <h-inoue@dream.email.ne.jp>
To: AYahorau@ibagroup.eu
Cc: pgsql-odbc@postgresql.org
Cc: MikalaiKeida@ibagroup.eu
Subject: Re: ODBC cliens is hanging if network connection is broken
Date: Sun, 8 Jul 2018 19:33:11 +0900
Message-ID: <ffaf4c40-becd-3bd0-a8e2-b96ff75acbfd@dream.email.ne.jp> (raw)
In-Reply-To: <OF33DF00A3.D6444835-ON432582C3.003EA7C5-432582C3.0045562B@iba.by>
References: <OF33DF00A3.D6444835-ON432582C3.003EA7C5-432582C3.0045562B@iba.by>
Hi,
On 2018/07/07 21:37, AYahorau@ibagroup.eu wrote:
> Hello PostgreSQL Community!
>
> I downloaded and installed the latest version of PostgreSQL from
> https://www.postgresql.org/ftp/source/v10.4/on my SLES 12 system.
> Here is my configuration of unixODBC:
>
> odbcinst,ini
> [PostgreSQL]
> Description=PostgreSQL ODBC driver
> Driver=/usr/local/lib/psqlodbcw.so
> FileUsage=1
>
> odbc.ini
> [sles12-1]
> Description = PostgreSQL connection to rtpdb
> Driver = PostgreSQL
> Database = rtpdb
> Servername = sles12-1
> Username =
> Password =
> Port = 5432
> Protocol = 7.4+
> ReadOnly = No
> RowVersioning = No
> ShowSystemTables = No
> ConnSettings =
>
> As a Driver in odbcinst.ini I specified the path to *psqlodbcw.so
> *which was downloaded from
> https://git.postgresql.org/gitweb/?p=psqlodbc.gitand built as follows:
> ./configure
> make
> make install
>
> Could you please provide a comment concerning the following situation?
>
> I created a simple ODBC program which calls "*SELECT
> pg_is_in_recovery()*" on the remote PostgreSQL server using ODBC API.
> It works good with this ODBC configuration. But as soon as I turn off
> network interface after *SQLConnect *call and before *SQLExecDirect*,
> it leads to *SQLExecDirect *hanging.
>
> I tried to use *statement_timeout* and
> *idle_in_transaction_session_timeout* postgresql configuration
> parameters but they were not suitable for network issue case. These
> parameters define server-side behaviour but a client considers that
> the connection is ok and it is hanging.
>
>
> As far as I know *SQL_ATTR_CONNECTION_TIMEOUT *ODBC attribute could
> handle this situation. Another ODBC driver for another database in
> case of similar situation returns *HYT01 *ODBC error (Connection
> timeout expired) . But I guess *SQL_ATTR_CONNECTION_TIMEOUT * is not
> supported by psqlodbc. Am I right?
How about calling SQLSetStmtAttr() with the attribute parameter
SQL_ATTR_QUERY_TIMEOUT?
>
>
> PostgreSQL JDBC driver provides *socketTimeout*property which helps a
> client to be informed about network problems and to avoid an infinite
> hanging.
> In my tests it returned *08006 *sqlstate (*connection_failure*).
>
> So I have a question. Is there any psqlodbc or native PostgreSQL
> mechanism or configuration parameter which helps a client to be
> informed about network problem?
> Is there any mechanism which helps to avoid this infinite hanging for
> SQL query in this case?
>
> Thank You in advance,
> Andrei Yahorau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: h-inoue@dream.email.ne.jp, AYahorau@ibagroup.eu, MikalaiKeida@ibagroup.eu
Subject: Re: ODBC cliens is hanging if network connection is broken
In-Reply-To: <ffaf4c40-becd-3bd0-a8e2-b96ff75acbfd@dream.email.ne.jp>
References: <OF33DF00A3.D6444835-ON432582C3.003EA7C5-432582C3.0045562B@iba.by> <ffaf4c40-becd-3bd0-a8e2-b96ff75acbfd@dream.email.ne.jp>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox