Thread: How to set a connection timeout

How to set a connection timeout

From
Ricardo Maia
Date:
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