    All Examples  This Package

# package examples.event.clockquery

##

- QueryOnTime
- Register

# about this package

The classes in this directory work together to demonstrate a time-triggered action that periodically makes a query to a DBMS and stores the current results in a WebLogic Workspace for shared access among multiple Clients.

The Register class sets up a registration of interest in a particular database. Its registration uses the QueryOnTime class in this directory as its Action class and the `weblogic.event.evaluators.EvaluateTime` class as its Evaluator class. The registration is interested in a by-the-second timer event, and its action is to insert a new dated row into a table that it creates in a database called "tempdb." After each database change, the action method also refetches the affected table into a dbKona DataSet that is stored in WebLogic's server-level Workspace, where it is available to multiple clients.

# how to use this package

This example has been set up for use with a Cloudscape database. You can use another database; just change the database-specific properties in both classes before compiling. If you need help on setting up a JDBC connection to a database, check out the Developers Guide for your JDBC driver. A list of WebLogic JDBC resources is available at WebLogic JDBC Options. Make sure to test your connection to the database before you try to use this example.

Once you've made any adjustments to the code, follow these steps:

1. Set up your development environment, as describe in Setting your development environment.

2. Compile Register.java to your CLIENT_CLASSES directory, with a command like this one for Windows NT:

         $ javac -d %CLIENT_CLASSES% Register.java

3. Compile QueryOnTime.java to your SERVER_CLASSES directory, with a command like this one for Windows NT:

         $ javac -d %SERVER_CLASSES% QueryOnTime.java

4. Start the WebLogic Server in your server shell.

5. Run the Register program from your development shell with this command:

        $ java examples.event.clockquery.Register WebLogicURL

   where WebLogicURL is the URL of the WebLogic Server. The example contains additional user, password, and server parameters, which are not used with Cloudscape. If you convert the example to work with another DBMS, you can include these arguments on the command line.

# there's more . . .

Check out the Developers Guide Using WebLogic Events for more about writing event-driven applications.