• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DriverManager.setLoginTimeout(10) not work as expected.

 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.".


 
Bring me the box labeled "thinking cap" ... and then read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic