3 Replies Latest reply on Jul 11, 2002 11:09 PM by Camus

    Configuring DataSource

    mukul joshi Newbie


      I am using JBoss 3.0 with Tomcat. I am using Oracle as my
      Database. I have configured an oracle-service with JNDI
      name 'DataSource'. In my EJB layer I am able to access
      this datasource by looking up 'java:/DataSource'.

      What I want to know is the configuration for the
      datasource to be accessed as
      'java:comp/env/jdbc/DataSource'. How do I set up my
      oracle-service to access the datasource thus.

      Many Thanks


        • 1. Re: Configuring DataSource
          Alan Moor Newbie

          I have included my oracle-service.xml. It registers a jndi name of "jdbc/memberzDB". code to access:

          ctx = new InitialContext();
          Context me = (Context) ctx.lookup("java:comp/env");
          ds = (DataSource)ctx.lookup("jdbc/memberzDB");

          • 2. Re: Configuring DataSource
            mukul joshi Newbie

            Many Thanks Alan.

            This works. The trick is the 2-step context lookup.
            Otherwise the single lookup of :
            "java:comp/env/jdbc/DataSource" always fails.



            • 3. Re: Configuring DataSource
              Camus Newbie


              Are you able to get the data connection from the lookup datasource and use that connection to do database operations, like prepare statement, ? If so, could you post those examples of configuration files (*.xml) ?

              I am suffering from the problem that I can't make use of the connection to do any database operations. It always says that the "connection handler is not currently associated with managedconnection".

              I am sure that the connection is binded to the oracle server. Actually, it works in JBoss2.4.4, but when migrating to JBoss 3, it doesn't work. Any changes to the bean's code ?

              Thanks in advance.