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

SQL Anywhere 12.0.1 » SQL Remote » 教程:创建 SQL Remote 系统

 

第 7 课:在远程数据库接收数据

在本课中,将在远程数据库 (field) 上运行消息代理,以接收从统一数据库 (hq) 发送的数据。

 ♦ 在远程数据库 (field) 接收数据
  1. 如果目前尚未连接到远程数据库 (field),则运行以下命令:

    dbisql -c "UID=DBA;PWD=sql;SERVER=server_field;DBF=c:\tutorial\field.db"
    
  2. 在远程数据库 (field) 上,从 c:\tutorial 目录运行消息代理:

    dbremote -c "UID=DBA;PWD=sql;SERVER=server_field;DBF=c:\tutorial\field.db;"
  3. 当消息代理窗口显示 [已执行完毕] 时,单击 [关闭]。

    c:\tutorial\field\hq.0 文件已被名为 c:\tutorial\hq\field.0 的文件取代。field.0 文件中包含接收确认信息。

  4. 验证远程数据库 (field) 中包含数据:

    1. 执行以下语句,查看 SalesReps 表的内容:

      SELECT * FROM SalesReps;

      SalesReps 表包含在统一数据库 (hq) 中输入的全部两行。这是因为 SalesRepData 发布包括 SalesReps 表的所有数据。

      rep_key name
      rep1 Field User
      rep2 Another User
      rep3 Example User
    2. 执行以下语句,查看 Customers 表的内容:

      SELECT * FROM Customers;

      Customers 表现在还包含在统一数据库 (hq) 中输入的 Land Sports 客户数据行。

      cust_key name rep_key
      cust1 Ocean Sports rep1
      cust3 Land Sports rep1
  5. 在统一数据库 (hq) 上,从 c:\tutorial 目录运行消息代理:

    dbremote -c "UID=DBA;PWD=sql;SERVER=server_hq;DBF=c:\tutorial\hq.db"

    c:\tutorial\hq 目录中,文件 field.0 消失。