pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Connection Timeout
5+ messages / 2 participants
[nested] [flat]

* Connection Timeout
@ 2010-05-31 23:13 Mike Toews <mwtoews@gmail.com>
  2010-06-03 09:01 ` Re: Connection Timeout Hiroshi Inoue <inoue@tpf.co.jp>
  0 siblings, 1 reply; 5+ messages in thread

From: Mike Toews @ 2010-05-31 23:13 UTC (permalink / raw)
  To: pgsql-odbc

Hi,

It doesn't appear there is a connection timeout parameter (e.g.,
ConnString="...;Timeout=5;..."), so I'm not sure how to throw an error
quicker if the driver cannot connect to the host:port. I'm waiting about 18
seconds, which I'd like to reduce to 5 seconds to streamline my program
startup if the postgres server is not available. Did I read the
documentation incorrectly, or are there any plans to introduce a Timeout
parameter? I'm using the latest version (08.04.0200).

There was a similar unanswered question a while ago:
http://archives.postgresql.org/pgsql-odbc/2003-06/msg00025.php

-Mike

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Connection Timeout
  2010-05-31 23:13 Connection Timeout Mike Toews <mwtoews@gmail.com>
@ 2010-06-03 09:01 ` Hiroshi Inoue <inoue@tpf.co.jp>
  2010-06-03 14:53   ` Re: Connection Timeout Mike Toews <mwtoews@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Hiroshi Inoue @ 2010-06-03 09:01 UTC (permalink / raw)
  To: Mike Toews <mwtoews@gmail.com>; +Cc: pgsql-odbc

Mike Toews wrote:
> Hi,
> 
> It doesn't appear there is a connection timeout parameter (e.g., 
> ConnString="...;Timeout=5;..."), so I'm not sure how to throw an error 
> quicker if the driver cannot connect to the host:port. I'm waiting about 
> 18 seconds, which I'd like to reduce to 5 seconds to streamline my 
> program startup if the postgres server is not available. Did I read the 
> documentation incorrectly, or are there any plans to introduce a Timeout 
> parameter? I'm using the latest version (08.04.0200).

What kind of tool(e.g. ADO, ADO.NET on Windows) are you using?

regards,
Hiroshi Inoue

> There was a similar unanswered question a while ago:
> http://archives.postgresql.org/pgsql-odbc/2003-06/msg00025.php
> 
> -Mike





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Connection Timeout
  2010-05-31 23:13 Connection Timeout Mike Toews <mwtoews@gmail.com>
  2010-06-03 09:01 ` Re: Connection Timeout Hiroshi Inoue <inoue@tpf.co.jp>
@ 2010-06-03 14:53   ` Mike Toews <mwtoews@gmail.com>
  2010-06-03 15:55     ` Re: Connection Timeout Hiroshi Inoue <inoue@tpf.co.jp>
  0 siblings, 1 reply; 5+ messages in thread

From: Mike Toews @ 2010-06-03 14:53 UTC (permalink / raw)
  To: Hiroshi Inoue <inoue@tpf.co.jp>; +Cc: pgsql-odbc

On 3 June 2010 02:01, Hiroshi Inoue <inoue@tpf.co.jp> wrote:

>
> What kind of tool(e.g. ADO, ADO.NET on Windows) are you using?
>
> regards,
> Hiroshi Inoue


I'm using the PostgreSQL Unicode ODBC driver with Python (pyodbc) and VBA
(ADO). I get the same 18 second timeout with both, regardless of what I
provide in the connection string. In VBA, there is a ConnectionTimeout
property, but it does not seem to have any influence, e.g.:

' With added reference Microsoft ActiveX Data Objects 2.x Library
Sub test()
    Dim Conn As New ADODB.Connection
    Dim ConnStr as String
    ConnStr = "Driver={PostgreSQL
Unicode};Server=123.4.5.6;Port=5432;Database=mydb;Uid=myid;Pwd=mypw;Timeout=5"
    Conn.CommandTimeout = 5
    Conn.ConnectionString = ConnStr
    Conn.Open
    Debug.Print "connected"
    Conn.Close
    Set Conn = Nothing
End Sub

It takes 15 seconds to throw an error at "Conn.Open, since the host is
invalid.

pyodbc has a Connection.timeout property, but it is for query timeout.

-Mike

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Connection Timeout
  2010-05-31 23:13 Connection Timeout Mike Toews <mwtoews@gmail.com>
  2010-06-03 09:01 ` Re: Connection Timeout Hiroshi Inoue <inoue@tpf.co.jp>
  2010-06-03 14:53   ` Re: Connection Timeout Mike Toews <mwtoews@gmail.com>
@ 2010-06-03 15:55     ` Hiroshi Inoue <inoue@tpf.co.jp>
  2010-06-03 17:02       ` Re: Connection Timeout Mike Toews <mwtoews@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Hiroshi Inoue @ 2010-06-03 15:55 UTC (permalink / raw)
  To: Mike Toews <mwtoews@gmail.com>; +Cc: pgsql-odbc

Mike Toews wrote:
> On 3 June 2010 02:01, Hiroshi Inoue <inoue@tpf.co.jp 
> <mailto:inoue@tpf.co.jp>> wrote:
> 
> 
>     What kind of tool(e.g. ADO, ADO.NET <http://ADO.NET; on Windows) are
>     you using?
> 
>     regards,
>     Hiroshi Inoue
> 
> 
> I'm using the PostgreSQL Unicode ODBC driver with Python (pyodbc) and 
> VBA (ADO). I get the same 18 second timeout with both, regardless of 
> what I provide in the connection string. In VBA, there is a 
> ConnectionTimeout property, but it does not seem to have any influence, 
> e.g.:
> 
> ' With added reference Microsoft ActiveX Data Objects 2.x Library
> Sub test()
>     Dim Conn As New ADODB.Connection
>     Dim ConnStr as String
>     ConnStr = "Driver={PostgreSQL 
> Unicode};Server=123.4.5.6;Port=5432;Database=mydb;Uid=myid;Pwd=mypw;Timeout=5"
>     Conn.CommandTimeout = 5

Please set the ConnectionTimeout preperty not the CommandTimeout one.
It seems to work here.

>     Conn.ConnectionString = ConnStr
>     Conn.Open
>     Debug.Print "connected"
>     Conn.Close
>     Set Conn = Nothing
> End Sub
> 
> It takes 15 seconds to throw an error at "Conn.Open, since the host is 
> invalid.
> 
> pyodbc has a Connection.timeout property, but it is for query timeout.
> 
> -Mike




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Connection Timeout
  2010-05-31 23:13 Connection Timeout Mike Toews <mwtoews@gmail.com>
  2010-06-03 09:01 ` Re: Connection Timeout Hiroshi Inoue <inoue@tpf.co.jp>
  2010-06-03 14:53   ` Re: Connection Timeout Mike Toews <mwtoews@gmail.com>
  2010-06-03 15:55     ` Re: Connection Timeout Hiroshi Inoue <inoue@tpf.co.jp>
@ 2010-06-03 17:02       ` Mike Toews <mwtoews@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Mike Toews @ 2010-06-03 17:02 UTC (permalink / raw)
  To: Hiroshi Inoue <inoue@tpf.co.jp>; +Cc: pgsql-odbc

On 3 June 2010 08:55, Hiroshi Inoue <inoue@tpf.co.jp> wrote:

>
> Please set the ConnectionTimeout preperty not the CommandTimeout one.
> It seems to work here.
>
>
Ah, of course (they almost look the same). That solution works for VB (ADO).

As for pyodbc, I can make a timeout function (e.g.,
http://nick.vargish.org/clues/python-tricks.html) and I'll probably
ask/request on their list about a connection_timeout property.

Thanks for your help.

-Mike

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2010-06-03 17:02 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-05-31 23:13 Connection Timeout Mike Toews <mwtoews@gmail.com>
2010-06-03 09:01 ` Hiroshi Inoue <inoue@tpf.co.jp>
2010-06-03 14:53   ` Mike Toews <mwtoews@gmail.com>
2010-06-03 15:55     ` Hiroshi Inoue <inoue@tpf.co.jp>
2010-06-03 17:02       ` Mike Toews <mwtoews@gmail.com>

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