 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
RC Guest
|
Posted: Wed Jul 23, 2003 12:25 pm Post subject: How to set JDBC connection timeout? |
|
|
The Subject says its all.
I can't do
DriverManager dm = new DriverManager();
But I can do
Connection c = DriverManger.getConnection("jdbc:......", properties);
My question is how do I use
DriverManger.setLoginTimeout(10);
to set the connection time out. If after 10 seconds still not
able to connect to the database, then time out. throw to
Exception
By default if there is something wrong with the database server
or the host. It may takes 30 seconds to catch in Exception.
I want to shorter it to only 10 seconds. How do I do that?
Thank Q very much in advance!
|
|
| Back to top |
|
 |
Sudsy Guest
|
Posted: Wed Jul 23, 2003 3:00 pm Post subject: Re: How to set JDBC connection timeout? |
|
|
RC wrote:
| Quote: | The Subject says its all.
I can't do
DriverManager dm = new DriverManager();
But I can do
Connection c = DriverManger.getConnection("jdbc:......", properties);
My question is how do I use
DriverManger.setLoginTimeout(10);
to set the connection time out. If after 10 seconds still not
able to connect to the database, then time out. throw to
Exception
By default if there is something wrong with the database server
or the host. It may takes 30 seconds to catch in Exception.
I want to shorter it to only 10 seconds. How do I do that?
Thank Q very much in advance!
|
DriverManger.setLoginTimeout(10);
Connection c = DriverManger.getConnection("jdbc:......", properties);
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|