Previous Topic Next topic Print topic


Demonstration Applications

A number of ODBC demonstration applications are supplied in the Samples Browser, available from Start > All Programs > Micro Focus Enterprise Developer > Samples > Visual COBOL Samples. These files are located in the %PUBLIC%\Documents\Micro Focus\Enterprise Developer\Samples\sql\openesql directory by default.

Before you can use any of the demonstration applications, you need to have installed at least one ODBC driver, and created DSNs to use with the demonstrations.

Some of the demonstration applications expect that a table called EMP exists on the database to which you are connecting.

The OpenESQL demonstration applications all produce a console log displaying their progress and, possibly, query results. They all terminate on receipt of an error, after displaying an error message.

The following applications are provided:

  • Behavior Demo

    Connects to a data source name LocalServer using the Microsoft SQL Server ODBC driver. To do this, see the Help topic To set up an ODBC data source name.

    The program creates and populates a table used by behavior.cbl and behavsub.cbl. After the table is created, we show how the BEHAVIOR directive makes the same ambiguous COBOL cursor declaration read only in behavior.cbl and updateable in behavsub.cbl.

    You can verify this by looking at the trace file OpenESQLTrace.processID.log, in the project directory. The log file is generated by the TRACELEVEL directive in behavior.cbl.

  • Catalog Demo

    Displays an SQL Data Sources dialog. Enter or select a name and click on OK. A Login dialog is displayed. Enter a login name of "admin", leave the password blank and click on OK. Performs three data dictionary queries and outputs the results.

  • Connect Demo

    Prompts for a data source, user name and password. Enter the data source name you created, a user name of "admin" and leave the password blank (just press return). Four tests which perform connects and disconnects using a variety of syntax options are run. The fifth test displays an SQL Data Sources dialog. Select the appropriate name from the Machine Data Source list and click on OK. A Login dialog is displayed. Enter a login name of "admin", leave the password blank and click on OK. The fifth test is run and the program terminates.

  • Select Demo

    Connects to the sample database and prompts for a customer code. Enter BLUEL (as the prompt suggests). Two fields from the customer record are displayed and the program prompts for another customer code. Just press the return key this time. The program prompts for a region. Enter CA (as the prompt suggests). The program displays a list of customers in that region and prompts for another region. This time, press the return key to terminate the program.

  • Static Demo and Dynamic Demo

    Both applications run the same sequence of tests, but using different SQL syntax options. They both start by prompting for a data source and user name. The test sequence is:

    1. connect
    2. drop test table
    3. create test table
    4. insert a row
    5. commit
    6. update the row
    7. read and verify
    8. rollback
    9. read and verify
    10. drop test table
    11. disconnect
    12. create test table

    Step two may output an error message - this is expected and the programs will continue. The final stage should produce an error message, and again this is not treated as a genuine error (though the absence of an ODBC error is treated as a test failure).

  • Whenever Demo

    Attempts to connect and displays an error message. Displays an SQL Data Sources dialog. Select the DSN name you created and click on OK. A Login dialog is displayed. Enter a login name of "admin", leave the password blank and click on OK. Tests error handling and outputs two error messages.

Previous Topic Next topic Print topic