Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 3748
    
  10

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
 
jQuery in Action, 3rd edition