From: George Weaver <gweaver@shaw.ca>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Postgresql and VBA - Connection Timeout
Date: Thu, 11 Jul 2019 15:24:52 -0500
Message-ID: <9ac39679-e7d0-7734-73fe-415af33397eb@cleartagsoftware.com> (raw)
In-Reply-To: <CH2PR11MB420071D05BA40CA4F4510F50B0F30@CH2PR11MB4200.namprd11.prod.outlook.com>
References: <CH2PR11MB420071D05BA40CA4F4510F50B0F30@CH2PR11MB4200.namprd11.prod.outlook.com>
On 11/07/2019 3:04 p.m., Wayne Mell wrote:
> Can someone help me with executing a postgres function from VBA? No
> matter what function I call, it always times out after exactly 30
> seconds. I've tried to use the statement_timeout a million different
> ways and always get an error that states "Cancelling statement due to
> statement timeout" in Access.
>
> Here is the code I've been using to test:
>
> Dim cnn As ADODB.Connection
> Dim cnnCmd As ADODB.Command
>
> Set cnn = New ADODB.Connection
> cnn.ConnectionString = "Driver={PostgreSQL
> Unicode(x64)};Server=postgres.office.server;Port=5432;Database=DBS;UID=postgresuser;PWD=postgrespwd;"
> cnn.ConnectionTimeout = 0
> cnn.Open
>
> Set cnnCmd = New ADODB.Command
> cnnCmd.CommandTimeout = 0
I found that the default of 0 meaning no timeout doesn't seem to work.
What happens if you set cnnCmd.CommandTimeout = 60 for the sleep test of 50?
George
>
> Set cnnCmd = cnn.Execute("select pg_sleep(50);")
>
> There are other functions that I've tried to execute, and they all
> work as long as they take less than 30 seconds to run. I just started
> running pg_sleep to test.
>
> If I log into pgAdmin with the same user name and password, and on the
> same machine, then the functions will execute no matter how long they
> take. It's only through VBA and the psqlODBC driver that I have the
> 30 second timeout limit.
>
> Has anyone found a way to make this work? Thanks.
>
>
--
Cleartag Software, Inc.
972 McMillan Avenue
Winnipeg, MB
R3M 0V7
(204) 284-9839 phone/cell
(204) 284-9838 fax
gweaver@cleartagsoftware.com
Fast. Accurate. Easy.
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: gweaver@shaw.ca, pgsql-general@lists.postgresql.org
Subject: Re: Postgresql and VBA - Connection Timeout
In-Reply-To: <9ac39679-e7d0-7734-73fe-415af33397eb@cleartagsoftware.com>
References: <CH2PR11MB420071D05BA40CA4F4510F50B0F30@CH2PR11MB4200.namprd11.prod.outlook.com> <9ac39679-e7d0-7734-73fe-415af33397eb@cleartagsoftware.com>
* 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