3 Replies Latest reply on Sep 23, 2005 5:07 AM by pv2005

    oracle with different useres

    pv2005

      Hi,

      I have several modules in my application , configuration module, administration module, management module,... and each module has a different user in Oracle.
      So how do I reflect this in the oracle-ds.xml ?
      I guess I cant have an oracle-ds.xml for each module in wich the only difference would be the user and pwd.
      What's the right aproach to this kind of question?

      my oracle-ds.xml is as follows:

      <datasources>
       <local-tx-datasource>
       <jndi-name>OracleDS</jndi-name> <connection-url>jdbc:oracle:thin:@192.168.10.200:1521:tt</connection-url>
       <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
       <user-name>adm</user-name>
       <password>adm</password>
       <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
       <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
       <!-- Checks the Oracle error codes and messages for fatal errors -->
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
       <!-- sql to call when connection is created
       <new-connection-sql>some arbitrary sql</new-connection-sql>
       -->
      
       <!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered
       <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
       -->
      
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
       <metadata>
       <type-mapping>Oracle9i</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>
      


      thank you, Pedro



        • 1. Re: oracle with different useres
          lafr

          You can put all your datasources into one oracle-ds.xml.
          The root tag datasources can have an unlimited number of local-tx-datasource children.

          • 2. Re: oracle with different useres
            pv2005

             

            "lafr" wrote:
            You can put all your datasources into one oracle-ds.xml.
            The root tag datasources can have an unlimited number of local-tx-datasource children.


            I've done that now I have
            <datasources>
            
             <local-tx-datasource>
             <jndi-name>OracleDS</jndi-name>
             <connection-url>jdbc:oracle:thin:@192.165.12.200:1521:ded</connection-url>
             <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
             <user-name>adm</user-name>
             <password>adm</password>
             <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
             <metadata>
             <type-mapping>Oracle9i</type-mapping>
             </metadata>
             </local-tx-datasource>
            
             <local-tx-datasource>
             <jndi-name>CliDS</jndi-name>
             <connection-url>jdbc:oracle:thin:@192.165.12.200:1521:ded</connection-url>
             <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
             <user-name>CLI</user-name>
             <password>321</password>
             <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
             <metadata>
             <type-mapping>Oracle9i</type-mapping>
             </metadata>
             </local-tx-datasource>
            
            </datasources>
            
            



            and when I use the OracleDS in my java class it works well but when I use the CliDS is says not bound.
            In the jmx-console there are both MBeans one for OracleDS and one for CliDS.
            What am I missing?

            thanks


            • 3. Re: oracle with different useres
              pv2005

              Found the solution in my java I had

              ds = (DataSource)ctx.lookup("java:comp/env" + db);
              


              and it was working fine for OracleDS

              now I've tried
              ds = (DataSource)ctx.lookup("java:" + db);
              


              and it works for both :)

              now I've a question about connection pooling but it's best to put it in a new thread.

              thanks