Wednesday, March 24, 2010

JBOSS Oracle XA Datasource Configuration

1) Copy the sample file from /opt/jboss-eap-5.0/jboss-as/docs/examples/jca/oracle-xa-ds.xml.

Note: For Oracle 10g, type name is used as Oracle 9i

Rename the file as required and edit to read as follows
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- ATTENTION:  DO NOT FORGET TO SET Pad=true IN transaction-service.xml  -->
<!-- ===================================================================== -->

<datasources>
  <xa-datasource>
    <jndi-name>jdbc/{your-jndi-name}</jndi-name>
    <!-- uncomment to enable interleaving <interleaving/> -->
    <isSameRM-override-value>false</isSameRM-override-value>
    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
    <xa-datasource-property name="URL">jdbc:oracle:thin:@{db-server-name}:1526:{db-name}</xa-datasource-property>

    <xa-datasource-property name="User">{db-user-name}</xa-datasource-property>

    <xa-datasource-property name="Password">{db-password}</xa-datasource-property>
    <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
    <no-tx-separate-pools/>
      <metadata>
         <type-mapping>Oracle9i</type-mapping>
      </metadata>
  </xa-datasource>

  <mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
         name="jboss.jca:service=OracleXAExceptionFormatter">
    <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
  </mbean>
</datasources>

2) Copy the ojdbc14_g.jar (oracle jdbc client jar) to location /opt/jboss-eap-5.0/jboss-as/server/default/lib
3) Copy {filename}-ds.xml file to /opt/jboss-eap-5.0/jboss-as/server/default/deploy or any directory defined in bootstrap/profile.xml
4) Restart the server if required. You should automatically see the data sources through the console.

5) If you want to encrypt the data source login information

5a) Edit /opt/jboss-eap-5.0/jboss-as/server/default/conf/login.xml and append the following application policy inside policy tags.
<application-policy name="{your-policy-name}">
<authentication>
<login-module code="org.jboss.resource.security.SecureIdentityLoginModule" flag="required">
<module-option name="username">ejb</module-option>
<module-option name="password">{db-encrypted-password}</module-option>
<module-option name="managedConnectionFactoryName">jboss.jca:name=jdbc/{your-jndi-name},service=XATxCM</module-option>
</login-module>
</authentication>
</application-policy>
where jboss.jca:name=jdbc/{your-jndi-name} is the same value defined in oracle-ds file

5b) Edit oracle-xa-ds.xml file.
Replace these lines

   <xa-datasource-property name="User">{db-user-name}</xa-datasource-property>
   <xa-datasource-property name="Password">{db-password}</xa-datasource-property>
with 
   <security-domain>{your-policy-name}</security-domain>

5c) Restart the server

1 Comments:

At January 23, 2015 at 9:10 PM , Anonymous sedot wc cikarang said...

keren mas

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

Newer›  ‹Older