Building and Running the ProjectThe StockQ project is available on the enclosed CD-ROM. Copy the project directory from the CD-ROM to your hard disk. Under Windows, start the server by double-clicking server.bat . Next, you can double-click client.bat and inquire about the availability of the various products. Warning This project uses Jetty as its Web server. However, because it is based on servlets, it should be easy to adapt to Web servers. You can add servlet support to most Web servers with JRun. The project on the CD-ROM includes databases for the client and the server, but if you need to re-create them, you can use Listings 9.15 and 9.16. Use Hypersonic SQL DatabaseManager to execute the script. To connect to the database, do the following:
Listing 9.15 client.sqlCREATE TABLE products(name VARCHAR,manufacturer VARCHAR,sku VARCHAR,level INTEGER); INSERT INTO products(name,manufacturer,sku,level) VALUES ('Email Client','Emailaholic', '100',10); INSERT INTO products(name,manufacturer,sku,level) VALUES ('Email Server','Emailaholic', '200',-1); INSERT INTO products(name,manufacturer,sku,level) VALUES ('Arcade Games','Playfield', '101',1); INSERT INTO products(name,manufacturer,sku,level) VALUES ('Mind Games','Playfield','202', 0); INSERT INTO products(name,manufacturer,sku,level) VALUES ('Exclusive Games','Playfield', '303',-1); Listing 9.16 server.sqlCREATE TABLE products(manufacturer VARCHAR,sku VARCHAR, level INTEGER); INSERT INTO products(manufacturer,sku,level) VALUES ('Emailaholic','100',1000); INSERT INTO products(manufacturer,sku,level) VALUES ('Emailaholic','200',-500); INSERT INTO products(manufacturer,sku,level) VALUES ('Playfield','101',10); INSERT INTO products(manufacturer,sku,level) VALUES ('Playfield','202',2); Note The project uses Hypersonic SQL for the database. Because Hypersonic SQL is a JDBC database, it should be easy to adapt it to other JDBC databases (including Access, Oracle, and SQL Server). |