java – 在不使用validate-on-match的情况下自动恢复Wildfly 8.2 for Oracle中的连接

我正在使用wildfly 8.2和oracle 11g,我的连接池刷新了无效的连接,并在可能的情况下创建一个新连接.我也在后端使用Spring和Hibernate(我们通过JNDI查找连接)

我无法在网上找到oracle池配置的简明示例,我可以开始工作,所以我从各种来源中抄袭了一些东西,并设法让它运行起来.

我的问题是这个.我设置“匹配时验证”等于true,但Jboss文档(https://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/beta500/html/ch13s13.html)说明了这一点

<validate-on-match> - Prior to JBoss 4.0.5, connection validation occurred when the JCA layer attempted to match a managed connection. With the addition of <background-validation> this is no longer required. Specifying <validate-on-match> forces the old behavior. NOTE: this is typically NOT used in conjunction with <background-validation>

如果我可以避免它,我不想使用“旧行为”.有没有人有一个使用Oracle 11g Wildfly 8.2自动恢复连接池的示例.并使用ojdbc6驱动程序.

谢谢

顺便说一句,我目前为游泳池设置的设置如下(nb我知道我将池大小设置为1,因此我可以轻松杀死会话并知道游泳池恢复).

 <datasource jta="true" jndi-name="java:/jboss/datasources/mydatabase" pool-name="mydatabase" enabled="true" use-ccm="true">
                    <connection-url>jdbc:oracle:thin:@localhost:1521:mydatabase</connection-url>
                    <driver-class>oracle.jdbc.OracleDriver</driver-class>
                    <driver>ojdbc6-11.1.0.7.0.jar</driver>
                    <pool>
                        <min-pool-size>1</min-pool-size>
                        <max-pool-size>1</max-pool-size>
                        <flush-strategy>FailingConnectionOnly</flush-strategy>
                    </pool>
                    <security>
                        <user-name>mydatabase</user-name>
                        <password>mydatabase</password>
                    </security>
                    <validation>
                        <check-valid-connection-sql>SELECT 1 FROM DUAL</check-valid-connection-sql>
                        <validate-on-match>true</validate-on-match>
                        <background-validation>false</background-validation>
                    </validation>
                    <timeout>
                        <set-tx-query-timeout>false</set-tx-query-timeout>
                        <blocking-timeout-millis>0</blocking-timeout-millis>
                        <idle-timeout-minutes>0</idle-timeout-minutes>
                        <query-timeout>0</query-timeout>
                        <use-try-lock>0</use-try-lock>
                        <allocation-retry>0</allocation-retry>
                        <allocation-retry-wait-millis>0</allocation-retry-wait-millis>
                    </timeout>
                    <statement>
                        <share-prepared-statements>false</share-prepared-statements>
                    </statement>
                </datasource>
            </datasources>

欢呼任何可以提供帮助的人

解决方法:

试试这个验证节点:

<validation>
    <background-validation>true</background-validation>
    <background-validation-millis>200000</background-validation-millis>
    <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
</validation>

请记住调整background-validation-millis的值.

上一篇:linux – 安装Oracle数据库机器的CPU使用率


下一篇:Oracle11G_PL/SQL