4 Replies Latest reply on Oct 9, 2002 1:22 PM by aloubyansky

    DataSource JNDI Cloudscape

    gmmehta

      Hi All,

      Need help with how to get the cloudscape datasource from data access objects.

      I am using JBoss-2.4.0_Tomcat-3.2.3

      I have the following entry in jboss.jcml

      <!-- ==================================================================== -->
      <!-- JDBC -->
      <!-- ==================================================================== -->


      COM.cloudscape.core.RmiJdbcDriver




      PowerdbDS
      org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
      jdbc:rmi://localhost:1099/jdbc:cloudscape:powerdb;create=false
      sa

      true


      1200000
      10
      false
      false
      false
      true
      120000
      1800000
      false
      1.0
      0


      I am developing a storefront. My architecture is as follows

      JSP --> Front Controller Servlet --> Session Facade --> Data Access Objects (DAO) --> Cloudscape DB

      What I do right now is to get the DataSource in the session facade e.g.
      context.lookup("java:/PowerdbDS"), get the connection and pass it to each
      method that I call on the Data Access Object e.g. registerUser(Connection conn, ValueObject value).

      I think this is BAD way to do this ????

      Hence, I was thinking of doing the lookup in the Data Access Object.

      I have read in the JBOSS documentaion that connections form the pool are not available outside jboss !!!

      SO HOW DO I DO THE LOOKUP IN THE DAO FOR THE DATASOURCE DECLARED IN jboss.jcml ???

      Help would be appreciated very much from any Marc Fleurys out there .... Thanks in advance.

      G




        • 1. Re: DataSource JNDI Cloudscape
          kayg

          Hi,

          Has this question ever been answered?

          Regards,

          Gong

          • 2. Re: DataSource JNDI Cloudscape
            aloubyansky

            I guess, Mark just didn't read this post :)

            Are there any problems with getting datasource in DAO? Are DAO classes outside of JBoss?

            • 3. Re: DataSource JNDI Cloudscape
              kayg

              Hi Kiev,


              Thank you for answering my question.

              I think I could get it work if I bundle the DAO classes with the session bean. That means I put all of them into one jar file. Then I can use the DAO classes to get the database connections from the DataSource sepcified in jboss.jcml.

              But we plan to put all DAO classes and some other util classes into one library jar file and place it under jboss/lib/ext directory so that they can be shared by all the beans (Is it a right approach?).

              If we do in this way, can the DAO classes still get the datasource connection via InitialContext?

              Regards,

              Gong

              • 4. Re: DataSource JNDI Cloudscape
                aloubyansky

                If you use session bean that uses DAO then you should get connection w/o problems if DataSource is bound in the server the session bean runs in.
                As to the right place to put common jar in 2.4.x, sorry I don't remember. Does 2.4 deploys usual jar files (not ejbs)? If so then I'd just deploy the shared jar. If not, then I think lib/ext is the right place.