pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedECPG connection timeouts
3+ messages / 3 participants
[nested] [flat]
* ECPG connection timeouts
@ 2008-03-18 22:47 Edmund Bacon <edmund.bacon@devstudios.com>
2008-03-23 17:34 ` Re: ECPG connection timeouts Michael Meskes <meskes@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: Edmund Bacon @ 2008-03-18 22:47 UTC (permalink / raw)
To: pgsql-interfaces
Is it possible to control how long ECPG takes when trying to connect to
a database on a remote system (e.g. connect to tcp:postgres//remote/db)
In my environment it is quite possible that the link to the remote
system may be down, so I'd prefer not to have to force the end-user to
wait 3+ minutes while ECPG CONNECT times out.
I've tried using sig_action()/alarm() and also tried using
setjmp/longjmp with alarm, but to no avail.
Is there anything I can do within ECPG other than try a plain old
connect() to the remote system on port 5432 and not proceed with a ECPG
CONNECT if that fails?
Thanks,
Edmund Bacon
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: ECPG connection timeouts
2008-03-18 22:47 ECPG connection timeouts Edmund Bacon <edmund.bacon@devstudios.com>
@ 2008-03-23 17:34 ` Michael Meskes <meskes@postgresql.org>
2008-03-23 18:14 ` Re: ECPG connection timeouts meskes@postgresql.org
0 siblings, 1 reply; 3+ messages in thread
From: Michael Meskes @ 2008-03-23 17:34 UTC (permalink / raw)
To: Edmund Bacon <edmund.bacon@devstudios.com>; +Cc: pgsql-interfaces
On Tue, Mar 18, 2008 at 04:47:51PM -0600, Edmund Bacon wrote:
> Is it possible to control how long ECPG takes when trying to connect to
> a database on a remote system (e.g. connect to tcp:postgres//remote/db)
With ecpg calling libpq's connect functions you can just look here for possible options:
http://www.postgresql.org/docs/8.3/interactive/libpq-connect.html
You should use something like
tcp:postgresql://server/database?connect_timeout=14 as database name in
a connect statement.
However, you will notice that this doesn't work as I just found that the
parser doesn't like the "=14" part. I will fix this in a minute.
Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: ECPG connection timeouts
2008-03-18 22:47 ECPG connection timeouts Edmund Bacon <edmund.bacon@devstudios.com>
2008-03-23 17:34 ` Re: ECPG connection timeouts Michael Meskes <meskes@postgresql.org>
@ 2008-03-23 18:14 ` meskes@postgresql.org
0 siblings, 0 replies; 3+ messages in thread
From: meskes@postgresql.org @ 2008-03-23 18:14 UTC (permalink / raw)
To: Michael Meskes <meskes@postgresql.org>; +Cc: Edmund Bacon <edmund.bacon@devstudios.com>; pgsql-interfaces
[Answering my own email ...]
Zitat von Michael Meskes <meskes@postgresql.org>:
> However, you will notice that this doesn't work as I just found that the
> parser doesn't like the "=14" part. I will fix this in a minute.
Need to step backward a little bit. Fixing the parser was easy, but
apparently PQsetdbLogin does not really set the option correctly.
Before looking for the bug which might be a formatting problem in ecpg
but appears to be a PQsetdbLogin limitation I think I better spend the
time upgrading to use PQconnectDB instead.
BTW shouldn't setting PGOPTIONS (?) accordingly work too? Not sure
after seeing PQsetdbLogin fail.
Michael
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2008-03-23 18:14 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-03-18 22:47 ECPG connection timeouts Edmund Bacon <edmund.bacon@devstudios.com>
2008-03-23 17:34 ` Michael Meskes <meskes@postgresql.org>
2008-03-23 18:14 ` meskes@postgresql.org
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