Building the database and running the sample application
The premise of the application is to build a basic personnel department application. The application will contain two main objects called employees and departments. Each employee must belong to only one department, but a department can have many employees.
To make it easier to construct the database, the SQL is provided in Listing 31.
Listing 31. SQL describing necessary database and tables
create database employeedb; create table departments( id varchar(50), name varchar(50), primary key (id) ); create table employees( id varchar(50), firstname varchar(50), lastname varchar(50), age integer, departmentid varchar(50), primary key (id), foreign key (departmentid) references departments(id));
The example application is available from the Download section of this tutorial. Download the file and extract it to the folder of your choosing.
To run the example application without using an IDE (Eclipse), please perform the following procedures.
- Copy zkinformix.war to $TOMCAT_HOME\webapps.
- Start Apache Tomcat
- Navigate to http://localhost:8080/zkinformix
To run the example application using an IDE (eclipse), please perform the following procedures.
- Copy the Informix driver (ifxjdbc.jar) to $TOMCAT_HOME\common\lib.
- Start Eclipse.
- Click File > Import.
- In the dialog, select Web > WAR file and then click Next.
- Use the browse button to locate zkinformix.war.
- Click Finish to import the Web Project.
- Right click zkinformix in the project explorer and select Run As > Run on Server.
- Select Apache > Tomcat v6.0 Server in the server type dialog, and click Finish.
- A browser will automatically start showing the zkinformix example.