Reputation: 963
Is there a way to set the timeout value in JDBC for the duration it tries to create a connection?(i.e. timeout for Driver.connect()
)
Upvotes: 1
Views: 1497
Reputation: 109174
You can use DriverManager.setLoginTimeout(..)
. Just be aware that not all drivers support this. Some drivers (also) provide a connection property to set the connect timeout.
Note that some JDBC drivers also have a connection timeout, which is not the same as the connect/login timeout. The connection timeout is - usually - the blocking timeout of the socket.
Upvotes: 1