Creating an Oracle Data Source in JBoss

To create a data source for the Oracle JDBC driver, edit the jboss.jcml file which is located in the JBoss/conf/<configuration> directory. For example:
C:\<JBoss_install>\jboss\conf\catalina

There is one modification, and one addition to make to this file.

  1. Replace this entry:
        <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider">
          <attribute name="Drivers">org.hsqldb.jdbcDriver</attribute>
        </mbean>
    	        

    With this entry:

        <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider">
          <attribute name="Drivers">oracle.jdbc.driver.OracleDriver,org.hsqldb.jdbcDriver</attribute>
        </mbean>
    	        
  2. Add the following entry just below the </mbean> that was just modified. Change the properties of the URL, JDBCUser, and Password to match your database configuration.
        <mbean code="org.jboss.jdbc.XADataSourceLoader" 
               name="DefaultDomain:service=XADataSource,name=OracleDS">
          <attribute name="PoolName">OracleDS</attribute>
          <attribute name="DataSourceClass">
            org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
          </attribute>
          <attribute name="URL">
            jdbc:oracle:thin:@rcleveng-sun:1521:RCLEVENG
          </attribute>
          <attribute name="JDBCUser">scott</attribute>
          <attribute name="Password">tiger</attribute>
          <attribute name="MinSize">0</attribute>
          <attribute name="MaxSize">10</attribute>
        </mbean>
    	        

The first modification allows the Oracle JDBC driver to be loaded and thus registered with the JDBC DriverManager class.

The second modification creates a JDBC data source bound to the JNDI name of java:/OracleDS.


Related topics

Working with the JBoss Application Server
Configuring JBoss for ADF Business Components Deployment
Deploying to the JBoss Application Server
Creating a JBoss Test Client for an EJB Session Bean

 

Copyright © 1997, 2004, Oracle. All rights reserved.