jboss 到oracle 数据库连接无效的问题

公司有一个业务系统使用的jboss,数据库是oracle 10gr2 rac,当一台实例宕机后,业务人员就会打电话反馈说系统无法登陆,或者在某个页面无法操作。同开发的哥们一同查看后台应用日志时,一直提示无法连接到数据库。


主要是jdbc 不支持 taf,只能通过检测连接池中连接的有效性来降低影响。


查看jboss的官方文档后,发现 在 ds.xml 还需要做一些简单配置。


下面是 ds.xml 的部分代码,重点说一下

    <background-validation-millis> 10000</background-validation-millis> 
    <!-- 这个是要用户手动添加的,定时间隔10000ms检测下连接池中连接的有效性,用什么检测,就执行下面蓝色字体类 --> 



    <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
    <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>

   <!-- 默认是注销的,需要用户手动启用,pingDatabase 这个词语描述的比较到位,这个类的最底层就是执行 select 'X' from dual --> 



   <!-- Checks the Oracle error codes and messages for fatal errors -->
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
        <!-- sql to call when connection is created
        <new-connection-sql>some arbitrary sql</new-connection-sql>
        -->

 
        <!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered
        <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
        -->
      

    


转载于:https://www.cnblogs.com/ctypyb2002/p/9793189.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值