JBoss.org Community Documentation

B.8. A Special Note About Oracle DataBases

In our setup discussed in this chapter, we rely on the JBoss AS to automatically create needed tables in the external database upon server startup. That works most of the time. But for databases like Oracle, there might be some minor issues if you try to use the same database server to back more than one JBoss AS instance.

The Oracle database creates tables of the form schemaname.tablename. The TIMERS and HILOSEQUENCES tables needed by JBoss AS would not get created on a schema if the table already exists on a different schema. To work around this issue, you need to edit the jboss-as/server/production/deploy/ejb-deployer.xml file to change the table name from TIMERS to something like schemaname2.tablename.


... ...
  <mbean code="org.jboss.ejb.txtimer.DatabasePersistencePolicy" 
         name="jboss.ejb:service=EJBTimerService,persistencePolicy=database">
    <!-- DataSourceBinding ObjectName -->
    <depends optional-attribute-name="DataSource">
      jboss.jca:service=DataSourceBinding,name=DefaultDS
    </depends>
    <!-- The plugin that handles database persistence -->
    <attribute name="DatabasePersistencePlugin">
      org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin
    </attribute>
    <!-- The timers table name -->
    <attribute name="TimersTable">TIMERS</attribute>
  </mbean>  
    
    

Similarly, you need to change the jboss-as/server/production/deploy/uuid-key-generator.sar/META-INF/jboss-service.xml file to change the table name from HILOSEQUENCES to something like schemaname2.tablename as well.


... ...
  <!-- HiLoKeyGeneratorFactory -->
  <mbean code="org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory"
         name="jboss:service=KeyGeneratorFactory,type=HiLo">
         
     <depends>jboss:service=TransactionManager</depends>

     <!-- Attributes common to HiLo factory instances -->
  
     <!-- DataSource JNDI name -->
     <depends optional-attribute-name="DataSource">jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>

     <!-- table name -->
     <attribute name="TableName">HILOSEQUENCES</attribute>
     
     ... ...