6 Replies Latest reply on Jan 8, 2004 8:32 AM by milowe

    Datasource JNDI name mapping

    firsttimer

      By default the Namespace used by JBoss for a datasource is: 'java:/Datasourcename', is it possible to change this to just 'Datasourcename' . Any example would be highly appreciated

      -Thanks in advance

        • 1. Re: Datasource JNDI name mapping
          jessstock

          I have the same question. Some one please answer!

          • 2. Re: Datasource JNDI name mapping
            mindschreck

            Greetings,

            I think I had the same issue, but correct me if I'm wrong. You want the JNDI datasource to not be in the java: namespace so that you can access it externally? If that's your question, then I have two answers:

            1.) You cannot move those datasources outside of java:, meaning they have to be used by JBoss components residing in JBoss' JVM.

            2.) You CAN move them externally by creating some sort of proxy objects with public remote interfaces that return datasource objects.

            That seems to be the picture I have gotten from others.

            Hope that helps!

            Cheers,
            Jason

            • 3. Re: Datasource JNDI name mapping
              jessstock

              Thanks for the info.

              Let me try and reword the question. I want to be able to map the JNDI name to "datasouce" with out the java:/. Then when I do a lookup in code, I don't have to have the java:/ in front of the data source name. WebLogic allows you to map the JNDI name to anything you wish. Thanks

              • 4. Re: Datasource JNDI name mapping
                tad_shimada

                Hi,

                Has anyone figured this out yet? Basically, I have the same question. I have the app that needs to be deployed into JBoss and WebLogic. For JBoss, I would have to look up the datasource using "java:/myDS". Any way to work around this so that I can just look it up by using "myDS" in my code? Or better yet, any way to look it up using "java:comp/env/myDS" in JBoss?

                Thanks in advance,
                TS

                • 5. Re: Datasource JNDI name mapping
                  nsdeonia

                  Hi

                  If you use "java:comp/env/jdbc/myDS" for look up to datasource from a session bean

                  add following to your tag in ejb-jar.xml

                  <resource-ref>
                  <res-ref-name>jdbc/myDS</res-ref-name>
                  <res-type>javax.sql.DataSource</res-type>
                  <res-auth>Container</res-auth>
                  </resource-ref>
                  and following to tag in jboss.xml

                  <resource-ref>
                  <res-ref-name>jdbc/myDS</res-ref-name>
                  <jndi-name>java:/YourDBPoolJNDIName</jndi-name>
                  </resource-ref>

                  I hope this will solve your problem.

                  regards
                  Narinder.

                  • 6. Re: Datasource JNDI name mapping
                    milowe