=============================
I.   Setup MySQL
=============================

1) Obtain and install MySQL for your platform
---------------------------------------------

The following links provide all the required information to obtain and
setup MySQL for a variety of platforms.

Download MySQL: http://dev.mysql.com/downloads/mysql/4.0.html
Install Instructions: http://dev.mysql.com/doc/mysql/en/installing.html

NOTE: You will need the password which was created during setup in
subsequent steps.

2) Start MySQL
--------------

This step depends upon your platform/distribution -- please refer to the
relevant documentation.

3) Create the freedb database in MySQL
--------------------------------------

The attached file will do a step by step setup of MySQL.
Do ONE of the following:
Entered by hand on the MySQL command line:

~ mysql -p

all entries from the file,

OR
inject directly from the file

~ mysql -p < /path/to/freedb.sql

This file will:
1) Create the database freedb
2) Create the albums and tracks tables inside the freedb database
3) Setup the user for accessing the database for the OpenEJB container
4) Create the indexes for the albums and tracks tables


=============================
II.  Add FreeDB Content
=============================

1) download FreeDB

Download one of the 'freedb-complete-YYYYMMDD' files from
ftp://ca.freedb.org/pub/freedb/.

Mirrors are available for the freedb files at:
http://www.freedb.org/modules.php?name=Sections&sop=viewarticle&artid=12

2) Extract the FreeDB archive

Create a temporary directory to store the extracted archive files.
Extract the archive into the temporary directory.

Be warned, this can take a very large amount of time, and will require
the ability to create more than 500,000 files in a single directory.  Be
sure your operating system is capable of this.

3) Converting FreeDB entries into SQL INSERTs

The attached file freedb-makesql.jar can be executed as follows:

java -Xmx1024m -jar freedb-makesql.jar

It will take the directory inside of which the command is invoked, and
recursively traverse the directory structure.  A single file will be
created containing the insert statements called freedb-insert.sql.  Thus,
it is possible to convert all of FreeDB into a single SQL text file.

The process could take a very long time, and it might be advisable to
do it in smaller parts as follows.  Execute this inside the directory
where the FreeDB archive was extracted:

for FILE in *
do
        if [[ -d $FILE ]]
        then
                java -Xmx1024m -jar freedb-makesql.jar ${FILE}
                mv freedb-insert.sql freedb-${FILE}.sql
        fi
done

Which would create files freedb-blues.sql, freedb-country.sql,
freedb-classical.sql, etc.  Each of which can be inserted in the following step
independently.

4) Executing the newly created SQL INSERT statements

To insert a .sql file generated during the previous step execute the following:

mysql -f -u root --password=demode freedb < freedb-insert.sql

If you chose to do genres independently, be sure to do the above command for
each of the output files you generated.

At this point the MySQL database is ready to go.


=============================
III.  Install OpenEJB
=============================

1) Extract OpenEJB

Unzip the file cddb-openejb.zip, this will create the directory "openejb".


2) Configure OpenEJB to use the local MySQL database

Make sure to update the ip address of the database specified in:

openejb/deploy/conf/openejb.xml
openejb/deploy/conf/CD.local.xml

3) Starting the OpenEJB Server

Change directory to the "openejb" directory.
Start OpenEJB as follows:

./openejb.sh start -h IP_ADDRESS -conf deploy/conf/openejb.xml

Where IP_ADDRESS is the IP_ADDRESS on which OpenEJB should listen.  If the
IP_ADDRESS is not specified then only clients which are on the localhost can
connect.
