Example: Sending, Receiving, and Viewing Data

Use the working example provided in the adapter distribution to learn how to send a SQL query to the adapter, and receive XML-formatted stream data from Event Stream Processor and view it in a Web browser.

Prerequisites
A network connection.
Task
  1. Set the username and password for the adapter:
    1. Edit adapter.xml.
    2. In the <User> and <Password> elements, enter sybase.
  2. Set the username and password in the example environment:
    Operating System Step
    UNIX
    1. Edit the set_example_env.sh script
    2. Set the ADAPTER_EXAMPLE_USERNAME and ADAPTER_EXAMPLE_PASSWORD variables to sybase.
    Windows
    1. Edit the set_example_env.bat script
    2. Set the ADAPTER_EXAMPLE_USERNAME and ADAPTER_EXAMPLE_PASSWORD variables to sybase.
  3. Start Event Stream Processor.
    Operating System Step
    UNIX Open a terminal window:
    1. Start the example cluster:

      start_node.sh

    2. Start the project on the cluster:

      start_project.sh

    Windows Open a command window:
    1. Start the example cluster:

      start_node.bat

    2. Add project to the cluster, and start it on the cluster:

      start_project.bat

  4. Edit the start_adapter.sh script.
  5. Set the JAVA_HOME environment variable to the directory where the Java Runtime Environment (JRE) is installed.
  6. Start the adapter.
    Operating System Step
    UNIX Open a terminal window and enter:

    start_adapter.sh

    Windows Open a command window and enter:

    start_adapter.bat

  7. Wait five to ten seconds for the adapter to initialize.
  8. Start uploading stream records.
    Operating System Step
    UNIX Open a terminal window and enter:

    ./upload.sh

    Windows Open a command window and enter:

    upload.bat

  9. Load the HTTPAdapterClient.html page in a Web browser.
  10. Enter a valid SQL query, for example:
    SELECT * FROM Stream1
    Note: Queries that return a smaller number of records may not appear on some browsers because those browsers appear to expect a certain amount of data to be present in the buffer cache before they display the data. For example:
    SELECT * FROM Stream1
    where intcol = 10
    • Mozilla FireFox browser -- displays record.
    • Google Chrome browser -- does not display record.
    • Internet Explorer browser -- does not display record.
    SELECT * FROM Stream1
    where intCol > 10
    (executed in debug mode)
    • Mozilla FireFox browser -- records appear after they are sent to the browser.
    • Google Chrome browser -- records appear after the fifth record is sent to the browser.
    • Internet Explorer browser -- records appear after the 20th record is sent to the browser.
  11. Click Submit.
    Note the records being streamed into the Web browser window.