The moose likes JDBC and the fly likes Regarding setLoginTimeout(int seconds) in JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Regarding setLoginTimeout(int seconds) in JDBC" Watch "Regarding setLoginTimeout(int seconds) in JDBC" New topic

Regarding setLoginTimeout(int seconds) in JDBC

RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
The docs say that

public static void setLoginTimeout(int seconds)

Sets the maximum time in seconds that a driver will wait while attempting to connect to a database.

Now if i set a Connection TimeOut for 5 secs , and how can i throw an exception on this if it exceeds 5 secs ??

If you want something you never had do something which you had never done
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703

It will throw the exception for you. You can catch it by putting a try/catch around the connection code.

My Blog: Down Home Country Coding with Scott Selikoff
I agree. Here's the link: http://aspose.com/file-tools
subject: Regarding setLoginTimeout(int seconds) in JDBC
Similar Threads
JVM memory releasing after memory consuming task
inconvertible types found : int required: java.lang.Short
read timeout not working after given period
Need help with a graceful failed database connection recovery
Adding 2 Times Together