2 Replies Latest reply on Oct 5, 2003 4:30 AM by bman917

    using MySql db for CMP

    sivaji_r

      SInce Jboss by default uses Hypersonic Db for persistence of entity beans, I would like to know how to make MySql the default db. And it would be helpful if someone could get me an example for CMP using JBOSS & MySql


      Thanx in advance,
      Sivaji

        • 1. Re: using MySql db for CMP
          bman917

          1. Install mySQL.
          2. make a database in mySQL
          3. download a jdbc driver from www.mysql.com
          4. the jdbc driver comes in a .jar file, place it in "JBoss_Home\server\deploy\lib" directory
          5. configure the the service for mySQL datasource via an xml document which you would place in the deploy directory. The format for the xml can be found at JBoss_Home\docs. There are examples there of xml configuration files that is set up for the popular databases. It is in this file that you would place the connection string for you mySQL database. This connection string would include the name of the database you created in step 2.
          6. Deploy your bean. Make sure to set the datasource in your jbosscmp-jdbc.xml to the datasource name you set in the xml datasource service configuration file.

          If you already implemented CMP using Hypersonic DB, you don't need to change anything in your bean implementation. You just need to change the datasource in your jbosscmp-jdbc.xml as described I described in step 6.

          Good luck. Hope this helps.

          • 2. Re: using MySql db for CMP
            bman917

            To make MySQL the default datasource for JBoss just rename the its datasource name to java:/DefaultDS in the xml service config file. Also, dont forget to remove or rename the Hypersonic datasource service.