3 Replies Latest reply on May 16, 2002 5:10 AM by Olger Warnier

    cmp and oracle connectivity Please help

    jawwad Newbie

      Please any one can send steps to connect to oracle8 with jboss3.0 alpha using cmp.It will be use full for all beginners and others.Please help.

      Thanks

      -----------------------------------------
      Sharing a Knowledge is gaining a Knowlege


        • 1. Re: cmp and oracle connectivity Please help
          Olger Warnier Newbie

          upgrade to the RC2 (RC2 is available via CVS)
          put the jdbc driver class file in your jboss/lib directory (e.g. classes111.zip for linux / classes12.zip for winnt)
          The attached files work only with the RC2 !

          first change your jboss/server/default/conf/login-config.xml (can be replaced with the attached one)
          replace the username and password in this file to your username and password

          after that add the oracle-service.xml to your jboss/server/default/deploy directory
          replace the hostname and sid in this file to your hostname and sid of the oracle server


          start the server.

          build a EJB that uses the OracleDS Datasource for testing. It is also possible to set the initial connections to 1. That way you will know if the connection succeeds during server startup

          • 2. Re: cmp and oracle connectivity Please help
            Paul Webster Newbie

            I've done all this and yes the DS now deploys fine using RC2. However when changing an entity bean that deploys fine using the defaultds to the orcaleds I get exceptions on create() - resource exception - Could not create comnnection. I can do a sql plus fine & I've trippled chacked the db params, url string etc. My minconnections is set to 1 in the pool & I get no probs with this when deploying the ds.

            Anyone any ideas? Or has someone a EJB using an oracle ds and running on RC2. I can't see a problem with my bean as like I said it works fine using defaultds.

            Any help would be much appreciated.
            Regards,
            Paul

            • 3. Re: cmp and oracle connectivity Please help
              Olger Warnier Newbie

              I've a number of beans running, using the OracleDS this way.
              Hereby some parts of the xml files:

              the ejb-jar.xml
              for one entity bean called AttributeDefintion


              <![CDATA[No Description.]]>

              <ejb-name>AttributeDefinition</ejb-name>

              nova.sm.AttributeDefinitionHome
              nova.sm.AttributeDefinition
              <local-home>nova.sm.AttributeDefinitionLocalHome</local-home>
              nova.sm.AttributeDefinitionLocal

              <ejb-class>nova.sm.AttributeDefinitionCMP</ejb-class>
              <persistence-type>Container</persistence-type>
              <prim-key-class>java.math.BigDecimal</prim-key-class>
              False
              <cmp-version>2.x</cmp-version>
              <abstract-schema-name>AttributeDefinition</abstract-schema-name>
              <cmp-field >
              <![CDATA[Returns the serviceAttributeID]]>
              <field-name>serviceAttributeID</field-name>
              </cmp-field>
              <cmp-field >
              <![CDATA[Returns the serviceID]]>
              <field-name>serviceID</field-name>
              </cmp-field>
              <primkey-field>serviceAttributeID</primkey-field>


              the jbosscmp-jdbc.xml

              <jbosscmp-jdbc>

              java:/OracleDS
              <datasource-mapping>Oracle8</datasource-mapping>

              <enterprise-beans>

              <ejb-name>AttributeDefinition</ejb-name>
              <create-table>false</create-table>
              <remove-table>false</remove-table>
              <table-name>TBL_SERVICEATTRIBUTE</table-name>
              <cmp-field>
              <field-name>serviceAttributeID</field-name>
              <column-name>SERVICEATTRIBUTEID</column-name>
              <jdbc-type>DECIMAL</jdbc-type>
              <sql-type>NUMBER(10)</sql-type>
              </cmp-field>
              <cmp-field>
              <field-name>serviceID</field-name>
              <column-name>SERVICEID</column-name>
              <jdbc-type>VARCHAR</jdbc-type>
              <sql-type>VARCHAR2(5)</sql-type>
              </cmp-field>

              the jboss.xml


              <enterprise-beans>

              <ejb-name>AttributeDefinition</ejb-name>
              <jndi-name>AttributeDefinition</jndi-name> <local-jndi-name>AttributeDefinitionLocal</local-jndi-name>



              See the defaults part in the jbosscmp-jdbc.xml pointing to the OracleDS (mind the caps)

              This should work.