1 Reply Latest reply on Jun 30, 2004 5:33 AM by aloubyansky

    reality check

    jbone


      I have been reading the forums re: datasource config and wanted to make sure I'm not making a dumb assumption.

      It is recommended that your JBOSS EJB's connect to a datasource at the beginning of whatever method you are going to use it with, and close that source at the end of the method. In other words, you shouldn't be caching database connections anywhere - correct?

      The reason why I ask is that the ejb spec has some recommendations for using ejbActivate and ejbPassivate for getting rid of resources like this, but in JBOSS using this method gives you the common "close your own connections" message.

      Is it OK to use ejbActivate and ejbPassivate to get/close db connections in JBOSS (provided of course its a stateful bean), or does the ManagedConnection pool make connecting to the DB so fast that its not really worth it?

      I have an app that uses CMP but makes a lot of DB calls anyway - just thinking about what the best way to set these up is so that it minimizes the load on the server. Any help appreciated.

        • 1. Re: reality check
          aloubyansky

           

          It is recommended that your JBOSS EJB's connect to a datasource at the beginning of whatever method you are going to use it with, and close that source at the end of the method. In other words, you shouldn't be caching database connections anywhere - correct?

          Correct. You don't have to code it because we do it in a proper way for you in our JCA implementation.