Lesson 4: Specifying class methods to handle events

This lesson assumes you have completed all preceding lessons. See Lesson 1: Compiling the CustdbScripts Java class with MobiLink references.

The class, CustdbScripts.class, created in the previous lesson encapsulates the methods UploadInsert and DownloadCursor. These methods contain implementations for the ULCustomer upload_insert and download_cursor events, respectively.

In this lesson, you connect to the CustDB database with Interactive SQL and run ml_add_java_table_script, specifying CustdbScripts.DownloadCursor to handle the download_cursor event.

 Specify CustdbScripts.DownloadCursor to handle the ULCustomer download_cursor event
  1. Connect to the sample database from Interactive SQL.

    1. Click Start » Programs » SQL Anywhere 12 » Administration Tools » Interactive SQL, or run the following command:

      dbisql
    2. Click ODBC Data Source Name and type SQL Anywhere 12 CustDB.

    3. Click Connect.

  2. Execute the following SQL statements in Interactive SQL:

    CALL ml_add_java_table_script(
        'custdb 12.0',
        'ULCustomer',
        'download_cursor',
        'CustdbScripts.DownloadCursor');
    COMMIT;

    The following is a description of each parameter:

    Parameter Description
    custdb 12.0 The script version.
    ULCustomer The synchronized table.
    download_cursor The event name.
    CustdbScripts.DownloadCursor The fully qualified Java method.
    Note

    Your updated download_cursor script might not appear in Sybase Central. To view the most recent changes to the MobiLink project in Sybase Central, click the View menu, and choose Refresh All.

  3. Close Interactive SQL.

  4. Proceed to Lesson 5: Running the MobiLink server with -sl java.

 See also