Using Tomcat's JDBC Connection pool in the project, the problem was that when the database was restarted, the service did not reconnect to the database and needed to restart the deployed project to connect to the database. After testing the configuration to make a change:
Add two configuration attributes where DataSource is configured:
<name= "Testonborrow" value= "true"/> <!-- An SQL statement used to verify that a connection is valid before it is returned to the caller, and if an SQL statement is specified, it must be a SELECT statement with at least one row of results -- < name= "Validationquery" value= "Select 1"/>
Such as:
<BeanID= "DataSource"class= "Org.apache.tomcat.jdbc.pool.DataSource"Destroy-method= "Close"> <!--Connection Info - < Propertyname= "Driverclassname"value= "${jdbc.driver}" /> < Propertyname= "url"value= "${jdbc.url}" /> < Propertyname= "username"value= "${jdbc.username}" /> < Propertyname= "Password"value= "${jdbc.password}" /> < Propertyname= "Maxactive"value= "${jdbc.pool.maxactive}" /> < Propertyname= "Maxidle"value= "${jdbc.pool.maxidle}" /> < Propertyname= "Minidle"value= "0" /> < Propertyname= "Defaultautocommit"value= "false" /> <!--timeout after connecting Idle10 minutes, check every 1 minutes - < Propertyname= "Timebetweenevictionrunsmillis"value= "60000" /> < Propertyname= "Minevictableidletimemillis"value= "600000" /> < Propertyname= "Testonborrow"value= "true"/> <!--an SQL statement used to verify that a connection is valid before it is returned to the caller, and if an SQL statement is specified, it must be a SELECT statement with at least one row of results - < Propertyname= "Validationquery"value= "Select 1"/> </Bean>
Problems with the Tomcat JDBC Connection pool not being re-connected