Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.1 » MobiLink - 入门 » MobiLink 教程 » 教程:使用 Java 同步逻辑

 

第 4 课:指定处理事件的类方法

本课假定您已完成前面的所有课程。 请参见第 1 课:使用 MobiLink 参考编译 CustdbScripts Java 类

上一课中创建的 CustdbScripts.class 类封装了 UploadInsert 和 DownloadCursor 方法。这些方法分别包含 ULCustomer upload_insert 和 download_cursor 事件的实现。

在本课中,您将通过 Interactive SQL 连接到 CustDB 数据库并运行 ml_add_java_table_script,从而指定 CustdbScripts.DownloadCursor 来处理 download_cursor 事件。

 ♦ 指定 CustdbScripts.DownloadCursor 来处理 ULCustomer download_cursor 事件
  1. 从 Interactive SQL 连接到示例数据库。

    1. 单击 [开始] » [程序] » [SQL Anywhere 12] » [管理工具] » [Interactive SQL],或运行以下命令:

      dbisql
    2. 单击 [ODBC 数据源名称],然后键入 SQL Anywhere 12 CustDB

    3. 单击 [连接]。

  2. 在 Interactive SQL 中执行以下 SQL 语句:

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

    以下是对每个参数的说明:

    参数 说明
    custdb 12.0 脚本版本。
    ULCustomer 同步表。
    download_cursor 事件名称。
    CustdbScripts.DownloadCursor 完全限定的 Java 方法。
    注意

    更新的 download_cursor 脚本可能不会出现在 Sybase Central 中。要在 Sybase Central 中查看 MobiLink 项目的最新更改,请单击 [视图] 菜单,然后选择 [全部刷新]。

  3. 关闭 Interactive SQL。

  4. 前进至第 5 课:使用 -sl java 运行 MobiLink 服务器

 另请参见