Using Java BluePrints Petstore 2.0 with GlassFish (Java EE 5 SDK app server) and mySQL database

Many folks have asked how to run Petstore 2.0 on Tomcat? Well, here are some instructions.
Also, see main page for BluePrints on GlassFish

Purpose of this page

Java Petstore 2.0 using MySQL DB with Java EE5 SDK/GlassFish can run on Java EE 5 SDK like GlassFish and also requires a database, and right now petstore 2.0 by default has instrcutions to run on Java DB with is included in GlassFish download. Here are some instructions on how to set petstore 2.0 up to use MySQL as the database.

Steps to use petstore 2.0 with MySQL

By André Dantas Rocha (andre.dantas.rocha@uol.com.br)

1. Edit *

Unknown macro: {petstore.home}

/bp-project/app-server.properties* and replace db.* entries by these ones:

db.delimiter=;
db.home=${javaee.home}/javadb
db.root=${db.home}
db.driver=com.mysql.jdbc.Driver
db.datasource=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
db.port=3306
db.sid=petstore
db.user=root
db.password=rootroot
db.url=jdbc:mysql://${javaee.server.name}:${db.port}/${db.sid}
db.admin.url=jdbc:mysql://${javaee.server.name}:${db.port}/mysql
db.jvmargs=-ms16m -mx32m
db.vendorname=SQL92

IMPORTANT! db.password cannot be blank

2. Copy MySQL Connector library (http://www.mysql.com/products/connector/j/) to *

Unknown macro: {javaee.hoje}

/javadb/lib*

3. Edit sql scripts in *

/setup/sql/javadb* dir

cities.del
Replace the contents of the file (see attached files)
petstore.sql
Put these statements in the begining of file:

create database petstore;
use petstore;

delete.sql
Replace all the statements by this one:

drop database if exists `petstore`;

4. Edit *

Unknown macro: {petstore.home}

/setup/javadb.properties* and include this entry:

db.import.src=./setup/sql/javadb/cities.del

5. Edit *

/setup/setup.xml*
In create-db target replace:

<![CDATA[
  CALL SYSCS_UTIL.SYSCS_IMPORT_TABLE (null, 'ZIPLOCATION', 
     '${petstore-setup.dir}/sql/javadb/cities.del', null, null, null, 0);
]]>

by:

<transaction src="${db.import.src}"/>

Replace *$

Unknown macro: {db.url}

* by *$

Unknown macro: {db.admin.url}

* in create-db (only first sql tag) and delete-db targets

6. After that you can do all procedures described in *

Unknown macro: {petstore.home}

/index.html*.