数据库连接池数据库异常自动重连配置汇总
来源:互联网 发布:java运行出现antbuild 编辑:程序博客网 时间:2024/04/30 04:48
在实际应用中,有的时候会遇到这样一种情况:
数据库和应用服务器分别在两台主机上,当数据库连接意外断开,自动重新连接后,应用和数据库能够重新连接成功,但是报表应用就无法使用了,必须重启应用服务器,才能继续使用报表应用。
下面介绍一种方法,使得不重启应用服务器就可以重新连接报表应用。
DBCP:
对属性 validationQuery 设置一个简单的SQL语句就行了,例如:select 1 (mysql 和 sql server 适用);
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:
以下标注红色的内容就是自动重连功能.
test
jdbc:oracle:thin:@192.168.0.1:1521:test
oracle.jdbc.driver.OracleDriver
test
select 1 from testtable–>
select 1 from testtable
5
20
032
- 数据库连接池数据库异常自动重连配置汇总
- 润乾报表数据库连接池数据库异常自动重连配置汇总
- 数据库连接中断恢复后自动重连配置汇总
- c3p0数据库连接池自动重连的配置
- c3p0数据库连接池自动重连的配置
- 数据库自动重连
- WebLogic连接池配置数据库断掉后自动重连设置
- Apache DBCP连接数据库异常重连
- 怎样在EOS中配置与数据库的自动重连
- 数据库重启后的重连配置
- ADO 数据库连接断开重连
- ADO 数据库连接断开重连
- 自动重连
- asmack自动重连
- mysql 自动重连
- TCP自动重连
- Spring RMI接口超时自动重连的配置
- jboss下mysql数据源自动重连的配置备忘
- vue+ElementUI实现订单页动态添加产品效果
- jquery中attr和prop的区别
- PAT数据结构_02-线性结构4 Pop Sequence (25分)
- 3个步骤,优雅地辅助运营将想法落地
- 关于 Eclisp 构建MAVEN 项目
- 数据库连接池数据库异常自动重连配置汇总
- Ultra-QuickSort
- 南非的5DT数据手套使用说明
- 造作:集合了全球顶尖设计师品牌的网站ui设计
- 网络状态监听
- BZOJ 2809 [Apio2012]dispatching【可并堆(贪心
- CNN(Convolutional Neural Networks)学习总结
- mysql_复制_2_异步复制
- bat文件命令学习