6 Replies Latest reply on May 30, 2005 2:45 PM by norman.richards

    HOWTO use Oracle9i with JBoss 4?

      I tried to use Oracle9i with JBoss 4 and faced some problems. This is what I've done:

      - copied docs/examples/jca/oracle-xa-ds.xml to server/default/deploy. Changed the values of <xa-datasource-property name="URL">, <xa-datasource-property name="User">, <xa-datasource-property name="Password"> to the proper ones.

      - in the ejb jar file of my application, I had the jbosscmp-jdbc.xml file like this:

      <!DOCTYPE jbosscmp-jdbc PUBLIC
       "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN"
       "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">
      <jbosscmp-jdbc>
       <defaults>
       <datasource>java:/XAOracleDS</datasource>
       <create-table>true</create-table>
       <alter-table>false</alter-table>
       <remove-table>false</remove-table>
       </defaults>
       <enterprise-beans>
       <entity>
       <ejb-name>CabinEJB</ejb-name>
       <table-name>Cabin_table</table-name>
       <cmp-field>
       <field-name>id</field-name>
       <column-name>cabin_id</column-name>
       </cmp-field>
       <cmp-field>
       <field-name>name</field-name>
       </cmp-field>
       </entity>
       </enterprise-beans>
      </jbosscmp-jdbc>
      


      I'm sure that it won't work with only these 2 steps. So what should I do next? (for example, change anything in standardjaws.xml, standardjbosscmp-jdbc.xml, login-config.xml ...)

      Or if you know any document showing how to do this, let me know please. I found one at http://www.onjava.com/lpt/a/4525, but it doesn't work with me :(

        • 1. Re: HOWTO use Oracle9i with JBoss 4?

          XA for oracle may require a couple of other steps. Do you really need XA? Try the normal oracle driver first. You'll find it much easier to get going.

          • 2. Re: HOWTO use Oracle9i with JBoss 4?

            Thanks Norman. I can use Oracle9i with JBoss using oracle-ds.xml. It's very simple. I wrote it down here so that newbies like me can take a look.

            - change oracle-ds.xml and copy the changed version to deploy directory

            - set Pad in jboss-service.xml to true

            - copy Oracle driver to lib directory

            - you should use jbosscmp-jdbc.xml in your ejb jar file so that you can leave the standardjbosscmp-jdbc.xml intact.

            This is my jbosscmp-jdbc.xml file

            <!DOCTYPE jbosscmp-jdbc PUBLIC
             "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN"
             "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">
            <jbosscmp-jdbc>
             <defaults>
             <datasource>java:/OracleDS</datasource>
             <create-table>true</create-table>
             <alter-table>false</alter-table>
             <remove-table>false</remove-table>
             </defaults>
             <enterprise-beans>
             <entity>
            


            <create-table> should be true if you don't have that table already created in your database.

            Good luck.

            Norman, I'll need your advice when I go to oracle-xa-ds.xml. Is that ok?


            • 3. Re: HOWTO use Oracle9i with JBoss 4?

              Don't use jbosscmp-jdbc.xml. It'll make your ejb unportable.

              Make a little change in standardjbosscmp-jdbc.xml and everything will be fine.

              • 4. Re: HOWTO use Oracle9i with JBoss 4?

                That is incorrect. There is no impact on portability. The changes are identical in their impact on portability, but keeping them in jbosscmp-jdbc.xml lets you keep the configuration local to one application. It also means that you won't have re-apply the global changes when you update to a newer version of JBoss.

                • 5. Re: HOWTO use Oracle9i with JBoss 4?

                  What I meant by portability is if we use jbosscmp-jdbc.xml, we cannot bring the whole directory contaning java and xml files to other application servers because they will not understand what jbosscmp-jdbc.xml is. Am I right?

                  • 6. Re: HOWTO use Oracle9i with JBoss 4?

                    You are correct that other application servers would not understand the file, but this wouldn't really cause any sort of problem. You'd need to add the appropriate deployment descriptors for the other application server, but the presence of the JBoss ones shouldn't impact the other server in any way.