USING MYSQL IN DEVELOPMENT

These steps pertain to JumpStart 4.12.2 and later.
They enable you to develop and test in Eclipse using a MySQL database instead of HSQLDB.
They assume you have installed a MySQL database server. JumpStart has been tested with MySQL Community Server 5.1.40.

  1. Create database and user.
    Using MySQL Workbench, MySQL Query Browser, or your preferred SQL tool:
    • Log in as user root.
    • If the database is on the same machine as your development environment, then execute the following statements. Otherwise, execute the statements with your development machine's IP address instead of localhost:
      • CREATE DATABASE IF NOT EXISTS jumpstart_dev;
      • CREATE USER 'jumpstart'@'localhost' IDENTIFIED BY 'jumpstart';
      • GRANT ALL PRIVILEGES ON jumpstart_dev.* TO 'jumpstart'@'localhost';
      • FLUSH PRIVILEGES;
  2. Get the MySQL database driver.
    • Edit business/build.xml, uncommenting references to mysql-connector-java-5.1.10.jar.
    • Using the project's build.xml, run the Ant target get-dependent-files.
    • Refresh the project.
    • Check that mysql-connector-java-5.1.10.jar is now in business/src/main/lib-runtime/.
  3. Modify the collapser to copy the right persistence.xml.
    • Edit the file collapser.xml, commenting out the line that copies openejb-hibernate-hsqldb-persistence.xml and un-commenting the line that copies openejb-hibernate-mysql-persistence.xml.
  4. Modify the openejb datasource configuration.
    • Edit the file business/src/test/conf/openejb.xml, commenting out the Resource sections involving HSQLDB and un-commenting the Resource sections involving MySQL.
    • Also modify the values of JdbcUrl, UserName, and Password to suit your MySQL database.
  5. Modify the business MANIFEST.MF.
    This step is not needed for the development environment, but it's worth doing now - it is needed later if you build an EAR file for an application server.
    • Edit the file business/src/main/resources/META-INF/MANIFEST.MF, adding ./lib/mysql-connector-java-5.1.10.jar to the Class-Path line.
  6. Clean the project.
    • In Eclipse, choose Project > Clean. . . > jumpstart.
You now have the following environment available to Eclipse:

Web Server Business Server Persistence Database Server Logger
Jetty OpenEJB Hibernate MySQL Log4j
(As a user library) (As a user library) (As jars in project) (Provided by you) (As jars in project)













©2010 Geoff Callender, Sydney, Australia