The Stock Client

   

Building and Running the Project

The 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:

  • Select Hypersonic SQL Standalone.

  • The URLs are jdbc:HypersonicSQL:db/client and jdbc:HypersonicSQL:db/server .

Listing 9.15 client.sql
 CREATE TABLE products(name VARCHAR,manufacturer VARCHAR,sku VARCHAR,level INTEGER); INSERT INTO products(name,manufacturer,sku,level) VALUES ('Email Client','Emailaholic', graphics/ccc.gif '100',10); INSERT INTO products(name,manufacturer,sku,level) VALUES ('Email Server','Emailaholic', graphics/ccc.gif '200',-1); INSERT INTO products(name,manufacturer,sku,level) VALUES ('Arcade Games','Playfield', graphics/ccc.gif '101',1); INSERT INTO products(name,manufacturer,sku,level) VALUES ('Mind Games','Playfield','202', graphics/ccc.gif 0); INSERT INTO products(name,manufacturer,sku,level) VALUES ('Exclusive Games','Playfield', graphics/ccc.gif '303',-1); 
Listing 9.16 server.sql
 CREATE 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).


   


Applied XML Solutions
Applied XML Solutions
ISBN: 0672320541
EAN: 2147483647
Year: 1999
Pages: 142

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net