此内容没有您所选择的语言版本。
18.6. Dead connections
The JDBC protocol does not provide a natural
connectionErrorOccured()
event when a connection is broken. To support dead/broken connection checking there are a number of plug-ins.
18.6.1. Valid connection checking 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Valid connections can be checked with an SQL statement (as shown below) before handing the connection to the application.
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
If this fails, another connection is selected until there are no more connections at which point new connections are constructed.
A potentially more performant check is to use vendor specific features, for example Oracle or MySQL's
pingDatabase()
tool:
<valid-connection-checker-class-name/>
<valid-connection-checker-class-name/>