I have set the DriverManager.setLoginTimeout(10), I expect if the connection cannot success within 10 seconds, it will give up and return a null conn, but the actual result is it wait for about 2 minutes 30 seconds and then return exception, why?
how to make the connection just try for 10 seconds, and if still cannot connect success within 10 seconds, then give up and return null connection?
the error log is
16:01:19,521 INFO [com.frw.database.DatabaseConnectionFactory] (default task-49) ComConfig.CHUBB_URL:jdbc:sqlserver://xx.xx.xx.xx:1464; DatabaseName=Director
16:01:19,521 INFO [com.frw.database.DatabaseConnectionFactory] (default task-49) ComConfig.CHUBB_QUERY_USER:DirectorQueryUser
16:03:49,603 ERROR [com.frw.database.DatabaseConnectionFactory] (default task-49) createChubbQueryConnection: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host xx.xx.xx.xx, port 1464 has failed. Error: "Connection timed out: no further information.. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".