wood burning stoves 2.0
The moose likes JDBC and Relational Databases 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 and Relational Databases
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: 3753

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

[OCA 8 Book] [Blog]
I agree. Here's the link: http://aspose.com/file-tools
subject: Regarding setLoginTimeout(int seconds) in JDBC
It's not a secret anymore!