Is there a jdbc connection property to auto reconnect to SQL Server 2012 using Microsoft JDBC Driver for SQL Server. I don't find it and I am using hikari cp for connection pooling . Plz let me know if there is a better way to reconnect to DB if connection lost . I am using spring-hibernate with hikari cp to connect to SQL Server 2012 using Microsoft JDBC Driver .
1 Answers
0
votes
Take a look at the connectionTestQuery
setup at this config file.
Also quoting the Documentation as a word of caution about this parameter:
connectionTestQuery If your driver supports JDBC4 we strongly recommend not setting this property. This is for "legacy" databases that do not support the JDBC4 Connection.isValid() API. This is the query that will be executed just before a connection is given to you from the pool to validate that the connection to the database is still alive. Again, try running the pool without this property, HikariCP will log an error if your driver is not JDBC4 compliant to let you know. Default: none