15.2.5.JDBC Sample Applications &Applets

JDBCDemo Java Application

  1. Go to the OpenLink Data Access Drivers "Start Menu" program group and then follow the JDBC Samples menu path to the appropriate JDK, and then JDBCDemo. This will execute a DOS batch program that initialises the Java demo application.

    Figure15.13.JDBC Demo

    JDBC Demo

  2. Set the JDBC Driver Name and URL settings for the connection to your database. The "Driver Name" field identifies the jdbc Driver. The "Connection URL" field requires a valid JDBC URL.

    Figure15.14.JDBC Demo

    JDBC Demo

  3. Enter a valid SQL statement and then click the "Query" button, the example below uses a SQL statement requesting all records from the "Customers" table.

    Figure15.15.JDBC Demo

    JDBC Demo

Rowset Java Application

  1. Go to the OpenLink Data Access Drivers "Start Menu" program group and then follow the JDBC Samples menu path to the appropriate JDK, and then Rowset Demo. This will execute a DOS batch program that initialises the Java demo application.

    Figure15.16.Rowset Demo

    Rowset Demo

  2. Set the JDBC URL settings for the connection to your database. The "Connection URL" field requires a valid JDBC URL.

    Figure15.17.Rowset Demo

    Rowset Demo

  3. Enter a valid SQL statement and then click the "Query" button. The first rowset of the resultset will be shown.

    Figure15.18.Rowset Demo

    Rowset Demo

  4. Click on the "Next" button to retrieve the next rowset, "Prior" to go back a rowset, "First" to move directly to the first rowset, and "Last" to move to the last rowset.

    "Delete", "Refresh", "Lock", "Unlock", "Add" and Update" work on the principle of a current row in the rowset. To indicate the current row to the applet, you must click on any column of a particular row and then press a key. The status panel will then display "Current Row = 2" or similar, indicating that the current row is set.

    Clicking "Delete" will attempt to delete the row from the database. Clicking on "Refresh" will now retrieve the latest values from the database to refresh that row. However this may not be successful dependent on the restrictions place on the resultset by the underlying database.

    "Lock" and "Unlock" will attempt to perform those operations on the current row, which again, may or may not be successful, dependent on the restrictions of the underlying database.

    "Add" will attempt to add the contents of the current row as a new row to the relevant tables forming the resultset. "Update" will attempt to update the modified contents of the current row to the database. Again the success of these two operations depend on the restrictions placed on the underlying database.

    "Get Bookmark" will attempt to retrieve a bookmark for the current rowset position, which "Set Bookmark" will attempt to return to.

    To move to a particular position in the resultset, enter that position into the edit box next to the "Goto" button and click the "Goto" button.

ScrollDemo2 Java Application

  1. Go to the OpenLink Data Access Drivers "Start Menu" program group and then follow the JDBC Samples-->ScrollDemo2 (JDK1.2) menu path, this will execute a DOS batch program that initializes the Java demo application.

    Figure15.19.


  2. Set the JDBC Driver Name and URL settings for your connection to a database of your choice. The "Driver Name" field identifies the OpenLink Driver. If it is left blank, then it defaults to "openlink.jdbc2.Driver", which is the OpenLink Driver for JDBC 2.0. The "Connection URL" field requires a valid OpenLink JDBC URL.

    Figure15.20.


  3. Enter a valid SQL statement and then click the "Query" button.

    Figure15.21.


  4. You can now use the navigational buttons to Scroll backwards and forwards, each of these navigational buttons highlights OpenLink's full implementation of the JDBC 2.0 Scrollable Cursors specifications.

ScrollDemo2 Java Applet

  1. Start the OpenLink Admin Assistant and then follow the Sample Applications-->JDBC Applet Demos menu path.

    Figure15.22.


  2. Click on the "ScrollDemo2" hyperlink which initializes the ScrollDemo2 applet, if you do not have a Java 1.2 or Java 2.0 compliant browser you will not be able to run this Applet demo. The other way to experience this demo is to run the Application version which uses your operating systems Java Virtual Machine (JVM) instead of a JVM inherently linked to a Web Browser.

JBench Application

  1. Go to the OpenLink Data Access Drivers "Start Menu" program group and then follow the JDBC Samples-->Jbench (for JDK1.1 1.2 or 1.3) menu path, depending on the JVM you have installed. This will execute a DOS batch program that initializes the JBench application.

    Figure15.23.


  2. The follow the File-->Connect menu path to make your initial connection. You will need to identify your JDBC Driver (by providing appropriate Driver Name values in the JDBC Driver field) and then provide a valid JDBC URL for your specific JDBC Driver.

    Figure15.24.


  3. Select the open JDBC connection that you wish to test.

  4. Follow the TPC-A-->Load Tables menu path to prepare your database for the TPC-A benchmark, select a database schema type that matches the database engine that you are benchmarking. If your database isn't listed ANSI should suffice (as long as this is an ANSI SQL compliant database).

    Figure15.25.


  5. Follow the TPC-A-->Load Procedures menu path to Load the TPC-A stored procedures.

  6. Now that all the benchmark data and stored procedures have been loaded into your database, follow the TPC-A-->Run Benchmark menu path and then configure your actual benchmark session parameters:

    The benchmark parameters fall into 4 categories, Bench execution mode, Run Options, SQL Options, and Execution Options.

    Figure15.26.


Bench execution mode:

These setting allow you to configure the threads used for the benchmark.

Decide on a single or multiple threads test.

No. Threads. this is the number of concurrent threads to be used during the benchmark.

Run Options:

These setting allow you to configure the duration related aspects of this benchmark program.

No. runs. this controls how many iterations of the benchmarks you actually run (the default is 100 benchmark iterations).

Duration (mins.). this is the duration in minutes of each benchmark run.

SQL Options:

These setting allow you to configure how your benchmark's SQL instructions are actually handled.

ExecDirect with SQL Text. this means that no form of repetitive SQL execution optimization is being applied (SQL statements are prepared and executed repetitively)

Prepare/Execute Bound Params. this means that the Parameter Binding SQL execution optimization is being applied (SQL is prepared once but executed many times without the overhead of re-preparing statements prior to execution)

Use Stored Procedures. this means that the Stored Procedure SQL optimization is being applied (benchmark instructions are stored within database being benchmarked)

Execution Options: These setting allow you to configure the tone of your benchmark, for instance it could have Transaction scoping and a mix of record retrieval queries, or it could simply be input and update intensive with a minimal amount of record retrieval queries (the case when the 100 row query checkbox is unchecked a typical OLTP scenario)

Use Transactions. make the benchmark use transaction control (instructions are scoped to transaction blocks)

Do 100 row Query. perform a simulation of a 100 record retrieval as part of the benchmark activity.

  1. Press Run or Run All to start your TPC-A benchmark. The Run All will sequence through all SQL and Execution combinations, so it will take much longer.

  2. Follow the TPC-A-->Cleanup menu path to clean up your database so that you can then run other benchmarks.