WildFly jdbc 与 Oracle 的连接

WildFly jdbc connection with Oracle

我尝试创建 jdbc 连接。 我使用 WildFly 应用服务器
9.0.0.CR1 和甲骨文 11g。 我把 ojdbc14 并在文件夹 C:\wildfly-9.0.0.CR1\modules\com\oracle\ojdbc14\main:

中创建了 module.xml
<?xml version="1.0" encoding="UTF-8"?> 
<module xmlns=xm lns="urn:jboss:module:1.0"" name="com.oracle.ojdbc14"> 
<resources> 
<resource-root path="ojdbc14.jar"/> 
</resources> 
<dependencies> 
<module name="javax.api"/> 
</dependencies> 
</module>

并插入到 standalone.xml:

<subsystem xmlns="urn:jboss:domain:datasources:1.0">     
            <datasources>
             <datasource jndi-name="java:jboss/datasources/accounting" pool-name="OracleDS" enabled="true" use-java-context="true"> 
                <connection-url>jdbc:oracle:thin:@cmx-itm-03:1521/COREJAVA</connection-url> 
                <driver-class>oracle.jdbc.OracleDriver</driver-class> 
                <driver>oracle</driver> 
                <security> 
                <user-name>Java_Learning</user-name> 
                <password>Qazxsw123</password> 
                </security> 
            </datasource> 
            <drivers>
                <driver name="oracle" module="com.oracle.ojdbc14"/> 
            </drivers>
            </datasources>
        </subsystem>

所以,我在尝试从控制台测试连接时遇到错误:

Unexpected HTTP response: 500

Request
{
    "address" => [
        ("subsystem" => "datasources"),
        ("data-source" => "OracleDS")
    ],
    "operation" => "test-connection-in-pool"
}

Response

Internal Server Error
{
    "outcome" => "failed",
    "failure-description" => "WFLYJCA0040: failed to invoke operation: WFLYJCA0042: failed to match pool. Check JndiName: java:jboss/datasources/accounting",
    "rolled-back" => true
}

我用谷歌搜索并尝试了我发现的所有方法,但仍然有这个错误。 请帮帮我。

这种故障有时很难修复,因为是自己服务器的异常。但是检查这个,检查你代码中的无效 jndiName。

https://issues.jboss.org/browse/AS7-2199

  1. 我把ojdbc14.jar改成了ojdbc6.jar;
  2. 用ojdbc6.jar定位module.xml到 wildfly-home\modules\com\oracle\ojdbc\main;
  3. 将最大池大小从 0 更改为 70。

所以,它有效