JEE6 : Dukes Forest Tutorial : Part 2

Out of the box, Dukes Forest tutorial is setup to use Java Derby as the database.

In order to use a different database, other than Derby, you will have to modify the jdbc-connection-pool setup in the glassfish-resources.xml file, which can be found under dukes-forest/dukes-store/setup folder.

You can find two different glassfist-resource.xml files, which have appropriate jdbc-connection-pool configurations for Derby & MySql databases, in the following location on GitHub:

You can replace the original glassish-resources.xml file with the contents of either of these two xml files and you would have switched from Derby to MySql or vice-versa.

The original code base does provide a dukes-forest-model.mwb (found under dukes-forest/entities/sql folder), which can be opened in MySQL Workbench and can be forward engineered to create an appropriate schema. I did create the initial DB via this method, but when i started the app, it did not work due to a DB related issue, which I had to resolve by adding a specific column to one particular table in the entire schema. Sorry, I have forgotten which table that was, but once that was fixed, i was able to run the full application without any issues.

Here is the dukes-forest-model.mwb and a sql script to create the entire forest schema, with test data, in a MySql database:

You should now be able to setup the DB using the SQL script, instead of the dukes-forest-model.mwb file and that should work without any issues. Do let me know if you run into any issues while running this script or the app.

Leave a Reply

Your email address will not be published. Required fields are marked *