aspose file tools*
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
Author

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
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

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