2 Replies Latest reply on Apr 29, 2003 8:59 AM by anupj

    EJB's and Default DataSource

    carcudi

      I'm running through a set of ejb examples, all of which will be (by default) run using the default HyperSonic DB, which is not exactly optimum from a DB management , query, etc. standpoint.

      All I'd like to do is automatically point the current application to an alternative DB (MySQL, Oracle) and use it by default rather than the JBoss "default." I've got a set of jboss-service.xml files I can use (whether embedded in the app or in the <server-config>/deploy directory.

      Can this be done through deployment descriptors, without resorting to a coded JNDI lookup in every bean (even entity beans)?

      The samples I've used before with embedded jboss-service.xml files included resource-refs in the jboss.xml and ejb-jar.xml files, and for all that, each bean still had to get a handle to the DS and run off that pool of connections. Not really practical in a CMP-managed app.

      Any suggestions?

        • 1. Re: EJB's and Default DataSource
          carcudi

          OK. This was easy: use the jbosscmp-jdbc.xml file.

          Nice and clean.

          One not so nice and clean part about it is the need to avoid using a realm to authenticate against your datasource because the default principal coming out of a deployed set of beans is NULL.

          Is there a DD specification for any of the three xml files (ejb-jar, jboss, jbosscmp-jdbc) which can assign a default principal?

          • 2. Re: EJB's and Default DataSource
            anupj

            In the jboss.xml

            add

            <unauthenticated-principal>system</unauthenticated-principal>
            I think, it will work