4 Replies Latest reply on Feb 13, 2002 3:54 AM by yudin

    database question

    mannu

      sorry for this other stupid question:
      What are the steps to add a new specific database in jboss?
      Should I create a Mbean in jboss.jcml?
      And after, should I create a type-mapping in standardjaws?
      Is it the right way?

      Be sure that I would be very happy to have many detailed answers...

        • 1. Re: database question
          gudujarlson

          I'm a jBoss newbie, but I have recently setup a MySQL datasource in jBoss 2.4.4. This is what I did:

          1. Put the MySQL JDBC driver in $(JAVA_HOME)/jre/lib/ext.
          2. Added the MySQL JDBC driver class to JdbcProvider mbean in jboss.jcml.
          3. Added a XADataSourceLoader mbean to jboss.jcml.
          4. Created a jboss.xml file and put it in the META-INF directory of my EJB jar file.
          5. Added a <resource-ref> to my ejb-jar.xml file.

          The relavant entries in jboss.jcml look like this:


          org.hsqldb.jdbcDriver,org.gjt.mm.mysql.Driver



          JobDB
          org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
          jdbc:mysql://localhost/JobDB
          administrator
          seremco


          My jboss.xml looks like this:


          <enterprise-beans>

          <ejb-name>Mike</ejb-name>
          <resource-ref>
          <res-ref-name>jdbc/JobDB</res-ref-name>
          <resource-name>JobDB</resource-name>
          </resource-ref>

          </enterprise-beans>
          <resource-managers>
          <resource-manager res-class="org.jboss.jdbc.XADataSourceLoader">
          <res-name>JobDB</res-name>
          <res-jndi-name>java:/JobDB</res-jndi-name>
          </resource-manager>
          </resource-managers>


          And my ejb-jar.xml looks like this:

          <ejb-jar>
          <enterprise-beans>

          <ejb-name>Mike</ejb-name>
          MikeHome
          Mike
          <ejb-class>MikeBean</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Container</transaction-type>
          <resource-ref>
          <res-ref-name>jdbc/JobDB</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
          </resource-ref>

          </enterprise-beans>
          <assembly-descriptor>
          <security-role>
          <role-name>everyone</role-name>
          </security-role>
          <method-permission>
          <role-name>everyone</role-name>

          <ejb-name>Mike</ejb-name>
          <method-name>*</method-name>

          </method-permission>
          <container-transaction>

          <ejb-name>Mike</ejb-name>
          <method-name>*</method-name>

          <trans-attribute>Required</trans-attribute>
          </container-transaction>
          </assembly-descriptor>
          </ejb-jar>

          I hope this helps.

          Mike

          • 2. Re: database question
            mannu

            thanks a lot Mike!

            • 3. Re: database question
              mannu

              My ejb works, thank you Mike. I have managed to connect my access db to my ejb entity, itself linked to a session bean. When i remove or create a ejb entity it makes the same thing in my db without sql ligne: it seems magic!
              next step : db2 wrapper...

              • 4. Re: database question
                yudin

                Hi All

                I'm also a jBoss (and java) newbie. I want to create a connection using a MS SQL 2000 JDBC Driver to MS SQL 2000. I have done the steps above but still get the following error msg:

                "javax.naming.NameMotFoundExecption : lasvr not bound"

                lasvr is the connection jndi name I used (I hope)

                Thanks
                Yudi