数据库连接中断恢复后自动重连配置汇总
2013-07-24 18:18
447 查看
DBCP
对属性 validationQuery 设置一个简单的SQL语句就行了,例如:select 1 (mysql 和 sql server 适用)。
WebLogic
-----转载自http://www.zhiweinet.com/weblogic
进入某个连接池配置页,进入“连接“页,点击高级选项的”show“显示高级选项。
指定 "测试频率" 并启用 "测试保留的连接"、"测试创建的连接" 和 "测试释放的连接"。
测试频率(Test Frequency): 60 秒
自动数据库连接测试之间的秒数(0 - 32 位正整数)。测试失败的连接将被关闭,然后重新打开以重新建立有效的物理数据库连接。(必须在下面指定测试表名称。)
The number of seconds (between 0 and a positive 32-bit integer) between automatic database connection tests. Connections that fail the test are closed and
reopened to re-establish a valid physical database connection. (You must specify a Test Table Name below.)
测试保留的连接(Test Reserved Connections)
指定 WebLogic Server 是否在将连接提供给客户端之前测试该连接。(必须在下面指定测试表名称。)
Specifies whether WebLogic Server tests a connection before giving it to the client. (You must specify a Test Table Name below.)
测试创建的连接(Test Created Connections)
指定 WebLogic Server 是否在创建连接后且将该连接添加到缓冲池中可用连接列表之前对该连接进行测试。(必须指定测试表名称。)
Specifies whether WebLogic Server tests a connection after creating it but before adding it to the list of connections available in the pool. (You must specify
a Test Table Name.)
测试释放的连接(Test Released Connections)
指定 WebLogic Server 是否在将连接返回到该 JDBC 连接缓冲池之前测试该连接。(必须指定测试表名称。)
Specifies whether WebLogic Server tests a connection before returning it to this JDBC connection pool. (You must specify a Test Table Name.)
连接保留超时(Connection Reserve Timeout): 设为 30 秒
在保留缓冲池连接的调用超时之前的秒数(-1 - 32 位正整数)。如果设置为 -1,则调用永远不会超时。
The number of seconds (between -1 and a positive 32-bit integer) after which a call to reserve a connection from the pool will timeout. When set to 0, a call
will never timeout. When set to -1, a call will timeout immediately
重试创建连接的频率(Connection Creation Retry Frequency): 设为 30 秒 尝试建立与数据库的连接的间隔秒数(0 - 32 位正整数)。适用于在数据库不可用的情况下服务器启动时创建的连接缓冲池。
The number of seconds (between 0 and a positive 32-bit integer) between attempts to establish connections to the database. Applies to connection pools created
at server startup when the database is unavailable.
钝化连接超时(Inactive Connection Timeout):
The number of inactive seconds on a reserved connection (between 0 and a positive 32-bit integer) before WebLogic Server reclaims the connection and releases
it back into the connection pool.
服务器申请复议连接并且保留返回给连接池前的钝化时间
测试表名称(Test Table Name):
oracle的连接池默认为 SQL SELECT 1 FROM DUAL,sybase数据库可以填入一个记录不多的配置表名例如sys_code。
The name of the database table to use when testing physical database connections. This field is required when you specify a Test Frequency and enable Test
Reserved Connections, Test Created Connections, and Test Released Connections.
JBoss
加上以下红色字体的内容就是加上自动重连功能!
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<check-valid-connection-sql>select 1 from testtable</check-valid-connection-sql>
*-ds.xml:
转自:http://hi.baidu.com/mianju/item/938bba0cc4386390a3df4314
对属性 validationQuery 设置一个简单的SQL语句就行了,例如:select 1 (mysql 和 sql server 适用)。
WebLogic
-----转载自http://www.zhiweinet.com/weblogic
进入某个连接池配置页,进入“连接“页,点击高级选项的”show“显示高级选项。
指定 "测试频率" 并启用 "测试保留的连接"、"测试创建的连接" 和 "测试释放的连接"。
测试频率(Test Frequency): 60 秒
自动数据库连接测试之间的秒数(0 - 32 位正整数)。测试失败的连接将被关闭,然后重新打开以重新建立有效的物理数据库连接。(必须在下面指定测试表名称。)
The number of seconds (between 0 and a positive 32-bit integer) between automatic database connection tests. Connections that fail the test are closed and
reopened to re-establish a valid physical database connection. (You must specify a Test Table Name below.)
测试保留的连接(Test Reserved Connections)
指定 WebLogic Server 是否在将连接提供给客户端之前测试该连接。(必须在下面指定测试表名称。)
Specifies whether WebLogic Server tests a connection before giving it to the client. (You must specify a Test Table Name below.)
测试创建的连接(Test Created Connections)
指定 WebLogic Server 是否在创建连接后且将该连接添加到缓冲池中可用连接列表之前对该连接进行测试。(必须指定测试表名称。)
Specifies whether WebLogic Server tests a connection after creating it but before adding it to the list of connections available in the pool. (You must specify
a Test Table Name.)
测试释放的连接(Test Released Connections)
指定 WebLogic Server 是否在将连接返回到该 JDBC 连接缓冲池之前测试该连接。(必须指定测试表名称。)
Specifies whether WebLogic Server tests a connection before returning it to this JDBC connection pool. (You must specify a Test Table Name.)
连接保留超时(Connection Reserve Timeout): 设为 30 秒
在保留缓冲池连接的调用超时之前的秒数(-1 - 32 位正整数)。如果设置为 -1,则调用永远不会超时。
The number of seconds (between -1 and a positive 32-bit integer) after which a call to reserve a connection from the pool will timeout. When set to 0, a call
will never timeout. When set to -1, a call will timeout immediately
重试创建连接的频率(Connection Creation Retry Frequency): 设为 30 秒 尝试建立与数据库的连接的间隔秒数(0 - 32 位正整数)。适用于在数据库不可用的情况下服务器启动时创建的连接缓冲池。
The number of seconds (between 0 and a positive 32-bit integer) between attempts to establish connections to the database. Applies to connection pools created
at server startup when the database is unavailable.
钝化连接超时(Inactive Connection Timeout):
The number of inactive seconds on a reserved connection (between 0 and a positive 32-bit integer) before WebLogic Server reclaims the connection and releases
it back into the connection pool.
服务器申请复议连接并且保留返回给连接池前的钝化时间
测试表名称(Test Table Name):
oracle的连接池默认为 SQL SELECT 1 FROM DUAL,sybase数据库可以填入一个记录不多的配置表名例如sys_code。
The name of the database table to use when testing physical database connections. This field is required when you specify a Test Frequency and enable Test
Reserved Connections, Test Created Connections, and Test Released Connections.
JBoss
加上以下红色字体的内容就是加上自动重连功能!
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<check-valid-connection-sql>select 1 from testtable</check-valid-connection-sql>
*-ds.xml:
<?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <jndi-name>test</jndi-name> <connection-url>jdbc:oracle:thin:@192.168.0.1:1521:test</connection-url> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <user-name>test</user-name> <password>123456</password> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name> <!--<new-connection-sql>select 1 from testtable</new-connection-sql>--> <check-valid-connection-sql>select 1 from testtable</check-valid-connection-sql> <min-pool-size>5</min-pool-size> <max-pool-size>20</max-pool-size> <idle-timeout-minutes>0</idle-timeout-minutes> <track-statements/> <prepared-statement-cache-size>32</prepared-statement-cache-size> </local-tx-datasource> </datasources>
转自:http://hi.baidu.com/mianju/item/938bba0cc4386390a3df4314
相关文章推荐
- 润乾报表数据库连接池数据库异常自动重连配置汇总
- 数据库连接池数据库异常自动重连配置汇总
- dbcp基本配置和重连配置 -- mysql 8小时自动断开连接的问题
- 怎样在EOS中配置与数据库的自动重连
- Eclipse(LUNA4.4.2)配置hibernate(4.3.8)连接数据库并自动生成代码
- Jboss数据库连接断开自动重连
- 配置phpmyadmin使登录时可填写IP管理多台MySQL 连接多个数据库 自动登录
- socket连接,判断连接中断,如果中断,并自动重连。
- 请教一下,数据库连接总是报中断然后又恢复,系统的监控软件总是告警,这种瞬间中断连接又瞬间恢复一般都是什么原因引起的?
- ZF1.*愤怒小鸟系列三:数据库操作之自动生成数据库连接配置
- 同步复制数据库,当网络问题,服务器间断开连接,复制中断后,自动继续复制的设置
- 一些tomcat数据库连接的配置的汇总
- 自动生成数据库连接配置文件的工具(调用VS2005数据源选择对话框)
- ArcSDE数据库连接(直连、服务连)与GT_Geometry存储配置图解
- 配置ORACLE 客户端连接到数据库
- 连接数据库的配置语句
- 在ASP.NET 2.0中操作数据之七十:配置数据库连接和命令等级设置
- C3P0配置连接数据库
- hibernate.cfg.xml配置文件,连接oracle数据库和mysql 数据库
- JavaWeb:Tomcat下配置数据源连接数据库