WebLogic Server 6.0 Code Examples, BEA Systems, Inc.

examples.dbkona
Class query

java.lang.Object
  |
  +--examples.dbkona.query

public class query
extends java.lang.Object

This simple example shows how to connect and execute queries with dbKona. You will need to have Oracle running the DEMO database, with WebLogic jDriver for Oracle (or another Oracle JDBC driver). This example is executed from the command line, and results are displayed to standard out. For other examples of how to display query results, check the server-side Java examples that use htmlKona and dbKona in the examples/htmlkona and examples/servlets folders.

If you don't have the Oracle DEMO database, you can use the file utils/ddl/demo.ddl to set it up.

The following section describes how to build and run the examples:

  1. Build the example
  2. Configure the server
  3. Run the example

Build the example

  1. Set up your development shell as described in Setting up your environment for building and running the examples.

  2. Compile the example by executing the following command or by executing the build script provided for this example in the samples/examples/dbkona directory. The script will perform the following step:

    1. Compile the query class as shown in this example for Windows NT/2000:

      $ javac -d %CLIENT_CLASSES% query.java

Configure the server

  1. Start the server with the examples configuration.

  2. Bring up the Administration Console in your browser with the URL:
    http://hostname:port/console
    where:
    hostname
    Host name of the WebLogic Server
    port
    Port where the WebLogic Server is listening for connections
  3. Click to expand the Services node in the left-hand pane.
  4. Click to expand the JDBC node in the left-hand pane.
  5. Click to expand the Connection Pools node in the left-hand pane.
  6. Select the oraclePool node.
  7. Select the Targets tab in the right-hand pane to display the Available and Chosen targets.
  8. Select the examplesServer target in the Available column.
  9. Click the mover control to move the examplesServer target to the Chosen column.
  10. Click the Apply button in the lower right-hand corner to save your assignment in the console configuration file.

Run the example

  1. Run this example by executing the following command in your development shell:

    $ java examples.dbkona.query

Author:
Copyright (c) 1996-2000 by BEA Systems, Inc. All Rights Reserved.

Constructor Summary
query()
           
 
Method Summary
static void main(java.lang.String[] argv)
          Here the JDBC connection is set up and created.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

query

public query()
Method Detail

main

public static void main(java.lang.String[] argv)
Here the JDBC connection is set up and created. A JDBC Statement is executed, and its resulting data is used to construct a dbKona QueryDataSet from the "emp" table in the Oracle DEMO database.

A QueryDataSet simplifies the client-side management of JDBC results by providing the infrastructure of a memory cache. QueryDataSets also allow records to be fetched incrementally. dbKona also provides methods associated with DataSets to automatically generate SQL. A QueryDataSet can be constructed with or without a JDBC ResultSet, which is shown in this method.

After working with the DataSet, we close it, as well as the JDBC ResultSet and the Statement used to execute the query.


Documentation is available at
http://e-docs.bea.com/wls/docs60

Copyright © 2000 BEA Systems, Inc. All Rights Reserved.