zoukankan      html  css  js  c++  java
  • 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>
            -->
          

        


  • 相关阅读:
    mac os programming
    Rejecting Good Engineers?
    Do Undergrads in MIT Struggle to Obtain Good Grades?
    Go to industry?
    LaTex Tricks
    Convert jupyter notebooks to python files
    How to get gradients with respect to the inputs in pytorch
    Uninstall cuda 9.1 and install cuda 8.0
    How to edit codes on the server which runs jupyter notebook using your pc's bwroser
    Leetcode No.94 Binary Tree Inorder Traversal二叉树中序遍历(c++实现)
  • 原文地址:https://www.cnblogs.com/ctypyb2002/p/9793189.html
Copyright © 2011-2022 走看看