Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 0D8E49FB4E3 for ; Mon, 16 Jul 2007 02:18:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 34263-06 for ; Mon, 16 Jul 2007 02:17:54 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id 951A69FB368 for ; Mon, 16 Jul 2007 02:18:04 -0300 (ADT) Received: (qmail 27446 invoked by uid 1112); 16 Jul 2007 05:17:54 -0000 Date: Mon, 16 Jul 2007 01:17:54 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Adrian Custer cc: pgsql-jdbc@postgresql.org Subject: Re: robust handling of initial connection with net interfaces down In-Reply-To: Message-ID: References: <1176991545.18583.4.camel@blackpad> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/65 X-Sequence-Number: 17239 On Thu, 19 Apr 2007, Kris Jurka wrote: > On Thu, 19 Apr 2007, Adrian Custer wrote: > >> i'm trying to make our app's connection to postgresql robust. In >> testing, I've noticed that if the network interfaces don't exist, the >> java instance locks up. >> >> 0.setup the server e.g. localhost:5432, user:auser, password:hello >> >> 1. Take down your network e.g. ifdown lo >> >> 2. run a simple connect to postgresql jdbc such as the file attached >> >> ==> the file hangs indefinitely. >> >> Does anyone have a suggestion for preventing this? >> > > The PG driver does not respect DriverManager.getLoginTimeout, although I'm > not sure why. You can instead add the URL parameter ?loginTimeout=5 or > similar to get a timeout on failure to setup a connection. > I've committed a change to CVS to make the driver check the DriverManager's loginTimeout setting if none has been specified explicitly via the URL. Kris Jurka