5 Replies Latest reply on Oct 5, 2002 12:42 AM by ravn

    Renaming JNDI /OracleDS to /comp/env/jdbc/DataSource

    ravn

      I need to rename the sample OracleDS specified in examples/jca/oracle-service.xml to another JNDI name in order to be able to switch between EJB-containers (a project requirement), by having standardized names.

      It has worked very well just by replacing the URI and username/password and referenced by /OracleDS in JNDI, but I cannot make the new name work. I have tried most combinations of changing the string OracleDS to comp/env/jdbc/DataSource in the XML file, but where the check code says that either jdbc or DataSource is not bound in JNDI.

      Do someone have a oracle-service.xml file where this change has been made I could have a look at? Or point me to the configuration file I need to change?

      Thanks in advance

        • 1. Re: Renaming JNDI /OracleDS to /comp/env/jdbc/DataSource
          chgrimm

          this did work for me





          <depends optional-attribute-name="ManagedConnectionFactoryName">
          <!--embedded mbean-->


          WORK_DS



          <config-property name="ConnectionURL" type="java.lang.String">jdbc:oracle:thin:@myserver:myport:myservice</config-property>
          <config-property name="DriverClass" type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property>
          <config-property name="UserName" type="java.lang.String">...myuser...</config-property>
          <config-property name="Password" type="java.lang.String">...mypassword...</config-property>




          <!--Below here are advanced properties -->
          <!--hack-->
          <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper



          <depends optional-attribute-name="ManagedConnectionPool">
          <!--embedded mbean-->


          0
          50
          5000
          15
          ByContainer



          <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

          <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager

          java:/TransactionManager

          <!--make the rar deploy! hack till better deployment-->
          jboss.jca:service=RARDeployer



          • 2. Re: Renaming JNDI /OracleDS to /comp/env/jdbc/DataSource
            ravn

            Thank you for your response.

            I can see that your oracle-service.xml registers in java:/WORK_DS, which I can get very nicely.

            I would like to have it in java:comp/env/WORK_DS, and just changing the JndiName does not work.

            Any suggestions?

            • 3. Re: Renaming JNDI /OracleDS to /comp/env/jdbc/DataSource

              It's working as "jdbc/XyzDS" here (JBoss 3.0.2 and 3.0.3) just by exchanging every occurence of "OracleDS".

              • 4. Re: Renaming JNDI /OracleDS to /comp/env/jdbc/DataSource

                Two different issues.

                your oracle-service.xml binds the datasource
                into local jndi
                java:

                your ejb-jar.xml and jboss.xml defines the component jndi
                java:comp
                in this case you want a <resource-ref>

                Regards,
                Adrian

                • 5. Re: Renaming JNDI /OracleDS to /comp/env/jdbc/DataSource
                  ravn

                  Thank you for the clarification and the pointer, which I used to get to the right place in the documentation (http://www.jboss.org/online-manual/HTML/ch05s22.html).

                  Adding a jboss-web.xml file to the WAR containing

                  <?xml version="1.0" encoding="UTF-8"?>
                  <jboss-web>
                  <resource-ref>
                  <res-ref-name>jdbc/DefaultDS</res-ref-name>
                  <res-type>javax.sql.DataSource</res-type>
                  <jndi-name>java:/OracleDS</jndi-name>
                  </resource-ref>
                  </jboss-web>

                  made it work as expected. Apologies for asking such a simple question :)