Menu

Advanced_installation_guide

Patrice Secheresse

Set up the database

The setup is needed when you want to use a different database. By default, the package provide the H2 database and does not need configuration.

H2 database

The use of H2 database is described in the page [Database_connection]. The driver is already integrated in the current distribution.

MySQL database

This database is more suitable for production. Install the database server and ensure that this database will start as a service. For more instruction, consult the MySQL documentation. Don't forget to download the jdbc driver.

Derby database

This database is suitable for developement and even production. You can find more on the site.

Create the database

You need to create an empty database volunteerDB except for H2 database (auto creation). Consult the database documentation.
All the tables are created by the system, you don't need to run a script (this parameter should be disabled after the installation, see intruction below).

Configure the driver

The driver must be inserted in distribution file (.war).
To configure, you need to decompress the war file as a zip file. Rename the extension of the file to .zip to decompress.
An excellent tool is 7-zip witch allow you to add, change, remove files directly without changing the extension, decompressing and recompressing (note: to edit correctly the Unix-like files, I have setup the 7-zip editor to the ConTEXT editor). Just rigth click VolunteerWeb.war and select open in 7-zip menu.
Remove unused drivers in the directory WEB-INF/lib. For example, remove debyclient.jar and h2.jar if you use MySQL. Insert the driver from MySQL by a drag and drop of the file in the 7-zip window.
[Image:volunteerWebWar.GIF]
Drivers tested :

  • h2 : already in the distribution
  • derby : you must obtain the derbyclient.jar file and insert it in the WEB-INF\lib directory
  • MySQL :you must obtain the jar file and insert it in the WEB-INF\lib directory

After inserting the driver, you need to open the VolunteerJPA.jar file (first line in the picture above) in WEB-INF\lib directory and open META-INF and edit persistence.xml.
Find the lines :

<property name="toplink.jdbc.user" value="sa"/>
<property name="toplink.jdbc.password" value=""/>
<property name="toplink.jdbc.url" value="jdbc:h2:tcp://localhost/volunteerDB"/>
<property name="toplink.jdbc.driver" value="org.h2.Driver"/>

Correct with your database user and password. Assuming your database is running on the same server, use the values below for the driver and url.

  • For Derby, set toplink.jdbc.url to "jdbc:derby:localhost:1527/volunteerDB" ; toplink.jdbc.driver to "org.apache.derby.jdbc.ClientDriver"
  • For MySQL, set toplink.jdbc.url to "jdbc:mysql:localhost/volunteerDB" ; toplink.jdbc.driver to "com.mysql.jdbc.Driver"

Important : it's better to remove the auto create table parameter in the persistence.xml file (see previous chapter to see how to open this file) after the first execution.
<property name="toplink.ddl-generation" value="create-tables"/> could be removed for better performance and to keep the sequence of id.

Installing the Web server

For more details, consult the TOMCAT documentation.
Install the Tomcat server and ensure that it start as a service.
You need to set a manager user and password to access the Manager tool. In the 'conf' folder of Tomcat installation, modify the file 'tomcat-user.xml'. For testing purpose, I set this line : <user username="tomcat" password="tomcat" roles="tomcat,admin,manager"/>.
For more information about user management, go to [usersAdministration users administration].
Start Tomcat and put this address in the address bar of your browser : [<http://localhost:8080/>] (note: the port is 8084 in the embedded Tomcat of NetBeans).
If your Tomcat installation is correct, you will see the Apache Tomcat main page.

Loading the distribution file using Tomcat manager

On the Tomcat main page, click on Tomcat manager. Give the admin user and password (for exemple, with the previous defined example parameter tomcat / tomcat).
On the Deploy panel, select the war file to deploy, or if you have decompressed the war file, select the directory and click Deploy.
The VolunteerWeb application must appear on the Applications panel. Click on the left on the VolunteerWeb, you should enjoy the welcome page. :)

Loading the distribution file directly in the depoyment directory

It is the simplest way to deploy the application. Stop the Tomcat web server, put the war file into the directory <INSTALLATION_DIR>\apache-tomcat-5.5.23\webapps (delete the old war file and the directory VolunteerWeb) and restart the server. Tomcat will auto deploy the application and expand the content in the VolunteerWeb directory.


Related

Wiki: AdvancedInstallationGuide
Wiki: Database_connection
Wiki: Installation_guide

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.