Re: ADO CommandTimeout vs Postgres statement_timeout parameter

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: Richard Hetherington <hetheringtonrichard(at)hotmail(dot)com>
Cc: "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: ADO CommandTimeout vs Postgres statement_timeout parameter
Date: 2016-05-26 08:27:10
Message-ID: 0A3221C70F24FB45833433255569204D1F57AAE6@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hello, Richard, Inoue-san,

Richard, please post to pgsql-odbc ML as much as possible, because I’d like Inoue-san to have a look. He is currently the only committer of psqlODBC, and I’m still an apprentice.

I implemented SQL_QUERY_TIMEOUT, which seems to work. Please find the attached patch.

Inoue-san,
At first, I used CC_send_settings() to execute “SET statement_timeout” and refactored it. After that, I realized I can use CC_send_query() and used it instead. However, I’d like the refactored code to be applied too.

Regards
Takayuki Tsunakawa

From: Richard Hetherington [mailto:hetheringtonrichard(at)hotmail(dot)com]
Sent: Friday, May 20, 2016 7:09 PM
To: Tsunakawa, Takayuki/綱川 貴之
Subject: RE: [ODBC] ADO CommandTimeout vs Postgres statement_timeout parameter

Many thanks for you advice. I realised after receiving your email that I had made a fundamental error - I was logging from a website to my desktop folder which clearly isn't going to be writable by a Web Identity Account - oops.

Attached are 2 log files which I have cleaned up to remove all UID, PWD, Server values etc.

You should see that I set the SQL_QUERY_TIMEOUT via the ADO CommandTimeout = 60 seconds

This value has been logged but has no effect on the long running query.
[7212-0.181]SetStmtOption: SQL_QUERY_TIMEOUT, vParam = 60

I hope this is useful.

If you need anything esle, let me know.

Many thanks and have a good weekend,

RICHARD
________________________________
From: tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com<mailto:tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: hetheringtonrichard(at)hotmail(dot)com<mailto:hetheringtonrichard(at)hotmail(dot)com>
Subject: RE: [ODBC] ADO CommandTimeout vs Postgres statement_timeout parameter
Date: Fri, 20 May 2016 02:39:30 +0000
Hello,

If SQL_QUERY_TIMEOUT is set on the connection or statement, mylog_xxx.log will have entries like this:

[140168204601088]PGAPI_SetConnectAttr for 0x8d5360: 0 0xa
[140168204601088]PGAPI_SetConnectOption: entering fOption = 0 vParam = 10
[140168204601088]SetStmtOption: SQL_QUERY_TIMEOUT, vParam = 10
...
[140168204601088][[SQLSetStmtAttr]] Handle=0x8e2110 0,10
[140168204601088]PGAPI_SetStmtAttr Handle=0x8e2110 0,10(0xa)
[140168204601088]PGAPI_SetStmtOption: entering...
[140168204601088]SetStmtOption: SQL_QUERY_TIMEOUT, vParam = 10

I'm not sure about the cause of your logging failure, but perhaps you will be able to log to another directory by creating the following registry value:

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\<your ODBC driver name>\Logdir
type: REG_SZ
value: directory path

Regards
Takayuki Tsunakawa

Attachment Content-Type Size
query_timeout.patch application/octet-stream 10.4 KB

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Cindy Taylor 2016-05-26 23:42:32 ODBC connections
Previous Message Tsunakawa, Takayuki 2016-05-26 02:40:45 [patch] fix buffer overrun in logging, and code cleanup