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

来源:互联网 发布:c语言教程 编辑:程序博客网 时间:2024/06/05 12:33

公司有一个业务系统使用的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>
        -->
      

    


0 0
原创粉丝点击