Wednesday, October 2, 2013

Configuring JBoss AS 7 Data Source with Oracle


1. Create directory for the oracle driver deployment

 $ cd $JBOSS_HOME/modules  
 $ mkdir -p com/oracle/ojdbc6/main  
 $ cd $JBOSS_HOME/modules/com/oracle/ojdbc6/main  
 $ vi module.xml  


2. Add following to the module.xml

 <module xmlns="urn:jboss:module:1.0" name="com.oracle.ojdbc6">  
  <resources>  
   <resource-root path="ojdbc6.jar"/>  
  </resources>  
  <dependencies>  
   <module name="javax.api"/>  
  </dependencies>  
 </module>  

3. Copy the downloaded ojdbc6.jar to the  $JBOSS_HOME/modules/com/oracle/ojdbc6/main
4. Edit following file

 $ vi $JBOSS_HOME/standalone/configuration/standalone.xml  

5. Look for following in the above file

 <subsystem xmlns="urn:jboss:domain:datasources:1.0">  

6. Insert following driver config in the drivers section

 <driver name="oracle" module="com.oracle.ojdbc6">  
   <xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>  
 </driver>  

7. Insert following data source under the data sources section

 <datasource jta="true" jndi-name="java:/myAppDS" pool-name="OracleDS" enabled="true" use-java-context="true" use-ccm="true">  
   <connection-url>[--connection url--]</connection-url>  
   <driver>oracle</driver>  
   <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>  
   <pool>  
     <prefill>true</prefill>  
     <use-strict-min>false</use-strict-min>  
     <flush-strategy>FailingConnectionOnly</flush-strategy>  
   </pool>  
   <security>  
     <user-name>[--user--]</user-name>  
     <password>[--password--]</password>  
   </security>  
 </datasource>  

No comments:

Post a Comment