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

SQL Anywhere 12.0.0 (中文) » UltraLiteJ » 使用 UltraLiteJ » 教程:构建用于 BlackBerry 的 UltraLiteJ 应用程序 » 第 2 部分:使用 MobiLink 同步 UltraLiteJ 应用程序

 

第 4 课:启动 MobiLink 服务器并在模拟器上运行应用程序

在可以运行 BlackBerry 应用程序和同步之前,MobiLink 服务器必须正在运行。MDS 模拟器也必须在运行以提供设备模拟器和 MobiLink 之间的通信通道。

  1. 通过从 c:\tutorial\database\ 运行以下命令启动 MobiLink:

    mlsrv12 -c " DSN=HelloBlackBerry" -v+ -x http(port=8081) -ot ml.txt

    -c 选项用于将 MobiLink 连接到 SQL Anywhere 数据库。-v+ 选项设置高级别的详细程度,以便您可以按照服务器消息窗口中发生的情况进行操作。-x 选项指示用于通信的端口号。-ot 选项指定将在启动 MobiLink 服务器的目录中创建日志文件 (ml.txt)。

  2. 选择 [开始] » [程序] » [Research in Motion] » [BlackBerry Email and MDS Services Simulator 4.1.2] » [MDS]。

  3. 在服务器中输入名称。

    1. 启动 Interactive SQL 并连接到 HelloBlackBerry 数据源。

    2. 运行下面的 SQL 语句以添加名称:

      INSERT Names ( Name ) VALUES ( 'ServerName1' );
      INSERT Names ( Name ) VALUES ( 'ServerName2' );
      COMMIT;
  4. 从 JDE 中,按下 F5 编译应用程序并在设备模拟器中运行该应用程序。

  5. 浏览至主屏幕并将名称添加到列表。

  6. 同步应用程序。

  7. 从主屏幕中,显示菜单项并选择 [同步]。

    在服务器中输入的名称会出现在屏幕中。如果从 Interactive SQL 来查询 Names 表中的名称,则会看到在模拟器中输入的名称都已到达服务器。