>>maybe you could use DriverManager.setLoginTimeout(int seconds)?
>
> Thanks, but what I wanted was to limit the time to get a connection,
> not the time of keeping connected.
Try the Javadoc next time. setLoginTimeout() 'sets the maximum time in
seconds that a driver will wait while attempting to connect to a
database'. It is exactly what you want, and it has nothing to do with
'the time of keeping connected'.
John_Woo - 06 Aug 2006 13:42 GMT
> >>maybe you could use DriverManager.setLoginTimeout(int seconds)?
> >
[quoted text clipped - 5 lines]
> database'. It is exactly what you want, and it has nothing to do with
> 'the time of keeping connected'.
Yes, the javadoc did say that.
guessed I have not yet got a good example illustrated what I wanted to
stop the attempting to get connection.
in my case:
DriverManager.setLoginTimeout(2); //A
System.out.println(DriverManager.getLoginTimeout());
Connection con = DriverManager.getConnection(url,"me", "pass"); //C
no matter what values set to line A (-1,0,1,,10),
it'll take 10-20 seconds to execute line C.
I still want to stop the execution of line c within 5 seconds.
Thanks
John