WebLogic Server 7.0 Code Examples, BEA Systems, Inc.

examples.dbkona
Class rowid

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

public class rowid
extends java.lang.Object

This example constructs a TableDataSet for inserting, updating, and deleting records from an Oracle database. It illustrates the use of an Oracle ROWID as a unique key for updates and deletes.

To run this example, you must have the Oracle DEMO database running. The connection to the database is made with WebLogic jDriver for Oracle. This example is run from the command line and the 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/servlets directories.

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. Set your PATH to include the path to the WebLogic jDriver for Oracle DLLs. For example:
    set PATH=%PATH%;C:\bea\weblogic700\server\bin\oci817_8

  3. Set your CLASSPATH to include the path the BEA_HOME folder where the license.bea file resides. For example:
    set CLASSPATH=%CLASSPATH%;C:\bea

  4. Open rowid.java for editing and find the following code block:
           Properties props = new Properties();
           props.put("user",     "scott");
           props.put("password", "tiger");
           props.put("server",   "DEMO");
     
    You may need to replace these values to fit your configuration.

  5. Compile the example by executing an ant build script or a command.

Run the example

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

    prompt> ant run_rowid

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

Constructor Summary
rowid()
           
 
Method Summary
static void main(java.lang.String[] argv)
          First the JDBC connection is configured and made.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

rowid

public rowid()
Method Detail

main

public static void main(java.lang.String[] argv)
First the JDBC connection is configured and made. Then a dbKona TableDataSet is constructed using the JDBC connection object and the name of the table. This example illustrates how to add new records and save them selectively. Then a KeyDef object (a unique attribute identifier) is created for updates and deletes; the records that were previously added are first updated, and then deleted to illustrate code for these two tasks. A final call to the save() method updates the DBMS with the changes made. The last few lines of code close all the data objects that were used in this example.

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

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