Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlfcl-0000dB-WC for pgsql-general@arkaria.postgresql.org; Thu, 11 Jul 2019 20:25:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hlfck-0008Vh-Q5 for pgsql-general@arkaria.postgresql.org; Thu, 11 Jul 2019 20:25:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlfck-0008Sy-6N for pgsql-general@lists.postgresql.org; Thu, 11 Jul 2019 20:25:02 +0000 Received: from smtp-out-so.shaw.ca ([64.59.136.138]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlfch-0006F6-5K for pgsql-general@lists.postgresql.org; Thu, 11 Jul 2019 20:25:01 +0000 Received: from [192.168.1.101] ([24.76.194.232]) by shaw.ca with ESMTPA id lfcZhsJWaIhW9lfcahIa0F; Thu, 11 Jul 2019 14:24:53 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shaw.ca; s=s20180605; t=1562876693; bh=TAvWQxzWC07ZhJ4CXdKr+P0FjD3n9Ju6W9yAk3fYh2g=; h=Subject:To:References:From:Date:In-Reply-To; b=fGLZLRwKylTsLV9bf6YMz5/ni8pUe4eZcxeoFJToTCkc3QyeVixwp3pTzbIj3egfG 2wSGUTw/tnbGlbzfn3qII7kyiNBQPKHBF+BjbGTZjrOzR3dxAaR2rcGcjrDZvlyxSg 00/AC9uPR5txdXwEDjVkmZdLBJhpanJNTCEQ8/DINw/hihpTqyxG54lr6/WPAaULQR L/CdL+96VhkWxvaCD7WR+DyXnZu6izH1MLoV05qCLdzeLarDLYDYzqyC29LEKsXZmx gFuSTxvdmqNlLIZMpcVIzH8V0AZRM1+8LRW7emoVjtF3IHfsivXtrB5TZjM7zLS7R/ FZ+S/Z1wO1g9A== X-Authority-Analysis: v=2.3 cv=FcFJO626 c=1 sm=1 tr=0 a=0Y1DvlpVpuM9kwNiWjvccA==:117 a=0Y1DvlpVpuM9kwNiWjvccA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=r77TgQKjGQsHNAKrUKIA:9 a=A0F02fRRAAAA:8 a=4342VTweVtq6o-rrfTIA:9 a=xnLxqMEUl5XD3ZOZ:21 a=TKKGwlaN_MKYrQpm:21 a=pILNOxqGKmIA:10 a=ruOvocUauscA:10 a=nmKYH5UWmP8A:10 a=TXuyPkCoqm4A:10 a=oanXi7KSuqIA:10 a=UqCG9HQmAAAA:8 a=br4DqajBXRuVzX8IuJIA:9 a=cIrzzTOcfl_CID9r:21 a=sqsuHWyEIBsf8j_3:21 a=mURVnN2zu4TsMIF3:21 a=_W_S_7VecoQA:10 a=frz4AuCg-hUA:10 a=Z19azF89xz0LKoqNrbu0:22 Subject: Re: Postgresql and VBA - Connection Timeout To: "pgsql-general@lists.postgresql.org" References: From: George Weaver Organization: Cleartag Software, Inc. Message-ID: <9ac39679-e7d0-7734-73fe-415af33397eb@cleartagsoftware.com> Date: Thu, 11 Jul 2019 15:24:52 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------6B8F41AFD6C894A31F49FBFF" Content-Language: en-US X-CMAE-Envelope: MS4wfEtyW2wuW6QUdJ+SN4DDTNkDttPhgsAA2ADtB7J1bVIAbyg1xcRJ6DApXqdTsjpLrkdqvyajquwRLNir2Tt2iyuvgmP/gDiNDa/eW0+T2ESWmlV86BX1 rz2zQZXcby77YkySGA5oAtecp2bd+xWrEO/kjyTst1K/8HwbrH0P2K9zyPXjpqsLdvJpKYkeLO3r0w== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------6B8F41AFD6C894A31F49FBFF Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit 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. --------------6B8F41AFD6C894A31F49FBFF Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit


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. 
--------------6B8F41AFD6C894A31F49FBFF--