How to set a connection timeout

From: Ricardo Maia <rmaia(at)criticalsoftware(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: How to set a connection timeout
Date: 2001-10-03 14:49:54
Message-ID: 0110031549540D.00770@valkyrie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


Hi,

I'am having some problems to set a connection timeout.

By default, when the IP set in the URL is incorrect (e.g doesn't exist or the
machine is down) the getConnection call takes too long to throw an exception.

I whould like to set this timeout to a few seconds.

I tried the following code, but it still doesn't work:

DriverManager.setLoginTimeout(10);
try{
jConnection = DriverManager.getConnection (f_strURL, f_strUsername,
f_strPassword);
}
catch(Exception e){

Thanks

Ricardo Maia

Browse pgsql-jdbc by date

  From Date Subject
Next Message Rene Pijlman 2001-10-03 17:45:17 Re: java.lang.OutOfMemory Exception with a large number of inserts
Previous Message Arsalan Zaidi 2001-10-03 07:13:12 java.lang.OutOfMemory Exception with a large number of inserts