ODBC & JDBC Sample Applications


A number of sample applications are bundled with your Universal Data Access Driver Suite installation for the following purposes:

  • To simplifying the process of getting the product up and running
  • To accelerate the support case creation and resolution process
  • To demonstrate the Data Access Driver Suite's unique product features highlighting the benefits it brings to your organization
  • To demonstrate application programming techniques that can used to aid and assist your ODBC and JDBC programmers

The Universal Data Access Driver Suite services are consumed primarily via ODBC and JDBC applications (OLE-DB applications connect via ODBC Data Providers for OLE-DB), thus separate ODBC & JDBC sample applications (including source code) have been packaged and integrated into the installer. The current list of sample applications include:

  • C++ Demo - an ODBC based Interactive SQL processor written in C++.
  • ODBC Bench Test - a 32 Bit C++ program based on the industry standard TPC-A benchmark (we will be extending this program to include the TPC-C and TPC-D benchmarks also). This program helps you compare the performance of Virtuoso against other backend database engines as well as compare the performance of various ODBC Drivers connecting to any ODBC compliant backend database.
  • ODBCTEST - ODBC based Interactive SQL processor written in 'C' for Linux & UNIX 
  • ScrollDemo2 - a JDBC 2.0 sample application that demonstrates Virtuoso's support of Scrollable Cursors and its ability to perform scrollable cursor operations across heterogeneous databases.
  • JBench - a Java and JDBC based adaptations of the industry standard TPC-A and TPC-C benchmarks. This program helps you compare the performance of Virtuoso against other backend database engines, it also helps you to compare the performance of various JDBC Drivers connecting to any JDBC compliant backend database.

Binary & Source File Locations

ODBC Demonstration Applications for Windows 95/98/NT/2000, Linux & UNIX:

The binary executables of these sample applications reside under the following directory structure:

<OPENLINK_INSTALLATION_DIRECTORY>\samples\odbc

The source code of some of these sample applications, when available, reside under the following directory structure, for example:

<OPENLINK_INSTALLATION_DIRECTORY>\samples\odbc\cppdemo

JDBC Demonstration Applications for Windows 95/98/NT/2000, Linux & UNIX:

The binary executables (Java class files), and sources for these sample applications reside under the following directory structure:

< OPENLINK_INSTALLATION_DIRECTORY>\samples\jdbc\<JDK_Version>\<Demo_name>

 

Windows 95/98/NT/2000 Based ODBC Sample Applications

C++ Demo

  1. Go to the OpenLink Data Access Drivers "Start Menu" item, then click on the "C++ Demo 32 Bit" menu item.


    sampl001.gif

  2. Follow the Environment->Open Connection menu path. Selecting the "Open Connection" menu item results in the ODBC Driver Manager presenting you with a list of ODBC DSNs on your machine as depicted by the screen capture below:


    sample1.gif

  3. Select the ODBC DSN that you wish to connect to, (in this case "Informix 7 on Local" has been chosen. This will connect you to the Informix 7 database.)

  4. You are then presented with a Login Dialog by the OpenLink Driver for ODBC, enter a valid user name and password into the appropriate fields.


    sample2.gif

  5. At this point you will be connected to the chosen datasource, you can now use the SQL-->Execute SQL menu path to open up the Interactive SQL input dialog. Enter a valid SQL statement (see example in screen shot) and then click on the "OK" button.


    sampl006.gif

  6. You will be presented with the results of your query.


    sampl007.gif

  7. You exit this demo by following the Environment-->Close Connection menu path.

ODBC Bench Test 32:

  1. Go to the OpenLink Data Access Drivers "Start Menu" item, then click on the "ODBC Bench Test 32 Bit" menu item. You will be presented with the "Bench Test" interface.


    sampl008.gif

  2. Follow the File-Connect menu path which initializes the ODBC Driver Manager, which in turn presents you with a list of ODBC DSNs installed on your machine. Select the DSN that you want to benchmark, remember that by benchmarking a DSN you are benchmarking the ODBC Driver that serves the DSN in question and the backend database engine that serves the ODBC Driver. Choose the name of the datasource you want to benchmark.


    sample1.gif

  3. You will then be presented with a Login Dialog by the OpenLink Generic Driver for ODBC, enter a valid user name and password into the appropriate fields.


    sample2.gif

  4. Now follow the Bench-->Load Tables menu path and you will be presented with a dialog that enables you to configure key elements of your benchmark. Click the "Execute" button to commence the process of setting up your database for the benchmark tests. Please make sure you select the appropriate schema for the DBMS that you are connecting to so that the benchmark tables are created properly.


    sampl011.gif

  5. As the process of loading data occurs, all the way up to completion, the benchmark program will provide status information into the benchmark output pane as shown below:

    sampl012.gif

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

    These benchmark parameters fall into 3 categories, Timing Options, SQL Options, and Execution Options.


    sampl013.gif


    Timing Options:
    These setting allow you to configure the duration related aspects of this benchmark program

    Minutes - this is the duration of each benchmark run

    Runs - this controls how many iterations of the benchmarks you actually run (the default is one benchmark iteration
    with a duration of 5 minutes)

    SQL Options:
    These settings 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 settings 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)

    Asynchronous - execute the benchmark instructions asynchronously

    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.
  7. Click on the "Run All" button if you would like all the different benchmark type combinations to be performed.

  8. When benchmark run complete benchmark data is written to the benchmark program's output pane.


    sampl014.gif


    The key pieces of benchmark data that you need to look out for are:

    Total Transactions
    - total number of transactions completed during the benchmark run

    Transactions Per Second
    - number of transaction completed per second for the benchmark run

    Information from this benchmark is automatically written to an Excel format CSV (the file c:\odbcbnch.csv) which makes it easy for you to graph and pivot data collated from several benchmark runs. A later version of this demo will actually write the benchmark data into an ODBC DSN that you provide thereby offering even more flexibility and accessibility to benchmark data.

 

Linux & UNIX Based ODBC Sample Applications

ODBCTEST:

This is a simple 'C' based and ODBC compliant Interactive SQL processor.

  1. Run the script openlink.sh to set up your environment:

    . openlink.sh
  2. Start ODBCTEST by executing the following command:

    odbctest

  3. At the SQL command prompt enter "?" for a list of ODBC DSNs on your machine or enter a valid ODBC Connect String e.g.


    If you have a DSN named "Marketing" you would enter: DSN=Marketing

 

ODBC Benchmark Application

The TPC-A, TPC-C, and TPC-D benchmarks are currently under development, please monitor our Web site (http://www.openlinksw.com) for updates on these applications.


JDBC Sample Applications & Applets

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.

    sample3b.gif

  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.


    sample4.gif

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


    sample5.gif (5734 bytes)

  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.


    image1.gif

  2. Click on the "OpenLink Software JDBC 2.0 Scrollable Cursors" 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 (JDK1.1) or Jbench (JDK1.2) menu path, depending on the JVM you have installed. This will execute a DOS batch program that initializes the JBench application.


    samp019b.gif (3150 bytes)

  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.


    samp020b.gif

  3. Follow the Results-->Table URL menu path, this is how you identify (using a JDBC URL) the location of the "Results" tables into which you will be storing your benchmark data. The default URL is the current JDBC URL (the one used to establish your initial connection), but this can be a totally different database to the one being benchmarked.
  4. Follow the Results-->Create menu path, this is how you actually perform the "Results" table creation in the database identified by the URL in the previous step.
  5. 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).


    sampl021.gif

  6. Follow the TPC-A-->Load Procedures menu path to Load the TPC-A stored procedures.
  7. 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.


    sampl022.gif (6653 bytes)


    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)

    Run All - this implies you want to perform all of the above benchmarks

    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.

  8. Run your TPC-A benchmark.

  9. Follow the TPC-A-->Cleanup menu path to clean up your database so that you can then run other benchmarks (TPC-C like benchmark).

  10. To run the TPC-C  benchmark simply follow the appropriate menu path, create the benchmark tables & stored procedures, load the benchmark data and then run the TPC-C benchmark.