How to set a connection timeout - Mailing list pgsql-jdbc

From Ricardo Maia
Subject How to set a connection timeout
Date
Msg-id 0110031549540D.00770@valkyrie
Whole thread Raw
List 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

pgsql-jdbc by date:

Previous
From: "Arsalan Zaidi"
Date:
Subject: java.lang.OutOfMemory Exception with a large number of inserts
Next
From: Rene Pijlman
Date:
Subject: Re: java.lang.OutOfMemory Exception with a large number of inserts