Top

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

15.2.1.C++ Demo

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

    Figure15.1.


  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:

    Figure15.2.


  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.

    Figure15.3.


  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.

    Figure15.4.


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

    Figure15.5.


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

15.2.2.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.

    Figure15.6.


  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.

    Figure15.7.


  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.

    Figure15.8.


  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.

    Figure15.9.


  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:

    Figure15.10.


  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.

    Figure15.11.


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.

  1. Click on the "Run All" button if you would like all the different benchmark type combinations to be performed.

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

    Figure15.12.


    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.

15.2.3.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

    Or pass a DSN connect string, for example:

    odbctest DSN=marketing;UID=name;PWD=pwd;
  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.

15.2.4.Mac OS X

ODBCTEST:

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

  1. Open a Terminal session, and start ODBCTEST by executing the following command:

    /Library/iodbc/bin/odbctest
  2. At the SQL command prompt enter "?" for a list of ODBC DSNs on your machine or enter a valid ODBC Connect String. If you have a DSN named "Marketing" you would enter:

    DSN=Marketing;UID=username;PWD=password

    Note: If there is no password, you must include a semicolon at the end:

    DSN=Marketing;UID=sa;PWD=;
  3. Any valid SQL or ODBC command may be executed through this interface. The following example shows a connection to Microsoft SQLServer 2000, making a simple query against the sample Northwind database:

    [localhost:~] openlink% /Library/iodbc/bin/odbctest
    iODBC Demonstration program
    This program shows an interactive SQL processor
    Enter ODBC connect string (? shows list, or DSN=...): DSN=user_tthib_sql2k
    SQL>select au_lname, au_fname, state from authors where au_id < '333-33-3333'
    au_lname                                |au_fname            |state
    ----------------------------------------+--------------------+-----
    White                                   |Johnson             |CA
    Green                                   |Marjorie            |CA
    Carson                                  |Cheryl              |CA
    O'Leary                                 |Michael             |CA
    Straight                                |Dean                |CA
     5 row(s) fetched.
    SQL>quit
    Again (y/n) ? n
    Have a nice day.
    [localhost:~] openlink%
    

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.