4 Replies Latest reply on Aug 8, 2004 4:38 AM by madadi

    How to include two data-sources in jbosscmp-jdbc.xml file?

    ashishabrol Newbie

      Hi Everyone,

      I have a small problem. In my jbosscmp-jdbc.xml i have defined the data-source in the following manner

      <jbosscmp-jdbc>

      java:/PSESPDS
      <datasource-mapping>Oracle9i</datasource-mapping>
      <create-table>true</create-table>
      <remove-table>false</remove-table>


      Could you please tell me how can i add a second data-source in this file because i am using some CMPs which are related to tables in another schema. Is it possible. If not do I have to create another jbosscmp-jdbc.xml file for that.

        • 1. Re: How to include two data-sources in jbosscmp-jdbc.xml fil
          Junior Carl Newbie

          What you've defined is the default datasource.

          Within each entity bean, you can define the datasource that it uses. If you don't define one, it'll default to your PSESPDS datasource.

          E.g.


          java:/PSESPDS
          <datasource-mapping>Oracle9i</datasource-mapping>
          <create-table>true</create-table>
          <remove-table>false</remove-table>

          <enterprise-beans>

          ...
          java:/DifferentDS
          <datasource-mapping>mySQL</datasource-mapping>
          <create-table>false</create-table>
          <remove-table>false</remove-table>
          ...

          • 2. Re: How to include two data-sources in jbosscmp-jdbc.xml fil
            Nischal Sharma Newbie

            hi,

            Thanks for the reply!.


            we have specified default datasource in the jbosscmp-jdbc.xml as
            given below:
            --------------------

            <jbosscmp-jdbc>

            java:/PSESPDS
            <datasource-mapping>Oracle9i</datasource-mapping>
            <create-table>true</create-table>
            <remove-table>false</remove-table>

            <enterprise-beans>

            <ejb-name>CandidatePedu</ejb-name>
            <table-name>CANDIDATE_PEDU</table-name>
            <cmp-field>
            <field-name>candidateId</field-name>
            <column-name>CANDIDATE_ID</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>pQualification</field-name>
            <column-name>P_QUALIFICATION</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>instute</field-name>
            <column-name>INSTITUTE</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>memberId</field-name>
            <column-name>MEMBER_ID</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>instituteCountryCode</field-name>
            <column-name>INSTITUTE_COUNTRY_CODE</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>street1</field-name>
            <column-name>STREET_1</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>institutePhoneCode</field-name>
            <column-name>INSTITUTE_PHONE_CODE</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>street2</field-name>
            <column-name>STREET_2</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>instituteCityCode</field-name>
            <column-name>INSTITUTE_CITY_CODE</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>city</field-name>
            <column-name>CITY</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>district</field-name>
            <column-name>DISTRICT</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>province</field-name>
            <column-name>PROVINCE</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>zipCode</field-name>
            <column-name>ZIP_CODE</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>countryId</field-name>
            <column-name>COUNTRY_ID</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>fromDate</field-name>
            <column-name>FROM_DATE</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>toDate</field-name>
            <column-name>TO_DATE</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>addInfo</field-name>
            <column-name>ADD_INFO</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>peduSeq</field-name>
            <column-name>PEDU_SEQ</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>houseNo</field-name>
            <column-name>HOUSE_NO</column-name>
            </cmp-field>

            </enterprise-beans>
            </jbosscmp-jdbc>
            ------------------------------------------------------------------------------

            that is we can define datasource for any entity bean by including this
            entity bean within the tag given below
            <enterprise-beans>
            </enterprise-beans>

            and having multiple <enterprise-beans> tag in one jbosscmp-jdbc.xml




            from
            Team member

            • 3. Re: How to include two data-sources in jbosscmp-jdbc.xml fil
              Junior Carl Newbie


              You need only to have one <enterprise-beans></enterprise-beans> tag.

              But within every tags, you can define the datasource that the particular entity bean uses.

              Check out the jbosscmp-jdbc.dtd (http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd).

              • 4. Re: How to include two data-sources in jbosscmp-jdbc.xml fil
                madadi Newbie

                hai,

                If i want to use Mysql and Open LDAP to store data like userid,last name,phone no:, email..etc can i configure my jboss ? presently i succeded to write CMP to store data in Mysql but i want to store same data in LDAP also.sothat user can search ,edit ..etc .so any ideas, help needed...

                Regards
                madadi