JBOSS 6 EAP oracle数据源配置

 中文版在  http://vase.iteye.com/blog/1299425

Create oracle DataSource Steps :

  1. Install driver as core module
    1. Create folder at  EAP_HOME/modules/



 
<此处有图片,如不显示请看附件>
Compare with other folders under modules you will find the last folder

Name is main.

我自己的module.xml

 

<?xml version="1.0" encoding="UTF-8"?>


<module xmlns="urn:jboss:module:1.1" name="jdbc.oracle">

    

    <resources>

        <resource-root path="ojdbc14.jar"/>

        

    </resources>


    <dependencies>

    <module name="javax.api"/>

<module name="javax.transaction.api"/>

    </dependencies>

</module>


 

2.Use CLI to install the driver 《这里是用JBOSS的CLI改的standalone.xml,也可参照最后直接改》

Under  EAP_HOME/runtimes/jboss-eap/bin  run   jboss-cli.bat

connect

Copy and modify below content to cmd and run

/subsystem =datasources/jdbc-driver=DRIVER_NAME:add(drivernam

e=DRIVER_NAME,driver-m odule-nam e=MODULE_NAME,driver-xa-datasource-classnam

e=XA_DATASOURCE_CLASS_NAME)

 

example:     《这里的driver-module-name与前面的module.xml里的name对应》

/subsystem =datasources/jdbc-driver=oracle:add(driver-name=oracle,driver-module-name=jdbc.oracle,driver-xa-datasource-class-name=oracle.jdbc.xa.client.OracleXADataSource)

Return success means you have installed the driver

Important  (如果你用的是ORACLE 10G)

这里要注意,因为ojdbc14.jar驱动不是jdbc4驱动,里面的META-INF中没有驱动描述和 一个叫java.sql.Driver的文件,所以我们要在中加入oracle.jdbc.OracleDriver来指定(如果用oralce11的驱动就没必要了)

 

也就是说还要在 standalone.xml作一些修改(加入彩色部分):

<driver name="oracle" module="jdbc.oracle">

                        <driver-class>oracle.jdbc.OracleDriver</driver-class>

                        <xa-datasource-class>

                     oracle.jdbc.xa.client.OracleXADataSource

                        </xa-datasource-class>

</driver>

 

《Refer to  http://vase.iteye.com/blog/1299425 》 

 

3.Install DataSource

Login in http://localhost:9990/console/App.html#datasources ,make sure  you are in Profile tab (top-right Conner )

Add 

Jndi -------java:jboss/datasource/OracleDS

connection-url----------jdbc:oracle:thin:@localhost:1521:xe

Test at bottom connection tab

 

 

 

 

 

改两个地方:
<datasource jta="false" jndi-name="java:jboss/datasource/OracleDS" pool-name="OracleDS" enabled="true" use-ccm="false">
                    <connection-url>jdbc:oracle:thin:@localhost:1521:xe</connection-url>
                    <driver-class>oracle.jdbc.OracleDriver</driver-class>
                    <driver>oracle</driver>
                    <security>
                        <user-name>xxx</user-name>
                        <password>xxx</password>
                    </security>
                    <validation>
                        <validate-on-match>false</validate-on-match>
                        <background-validation>false</background-validation>
                    </validation>
                    <statement>
                        <share-prepared-statements>false</share-prepared-statements>
                    </statement>
 </datasource>
                
---------------------------------------------------------------------------------------------------------      
   <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                    <driver name="oracle" module="jdbc.oracle">
                        <driver-class>oracle.jdbc.OracleDriver</driver-class>
                        <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                    </driver>
     </drivers>
 

猜你喜欢

转载自k1280000.iteye.com/blog/1638713