此内容没有您所选择的语言版本。
14.7. 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 plugins.
14.7.1. Valid connection checking 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
The simplest format is to just run a "quick" sql statement:
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
before handing the connection to the application. If this fails, another connection is selected until there are no more connections at which point new connections are constructed.
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
The potentially more performant check is to use vendor specific features, e.g. Oracle's or MySQL's pingDatabase() via the
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
<valid-connection-checker-class-name/>
<valid-connection-checker-class-name/>