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 システムの作成

 

レッスン 8:リモートデータベースから統合データベースにデータを送信する

このレッスンでは、リモートデータベース (field) から統合データベース (hq) にデータを送信します。

 ♦ リモートデータベース (field) から統合データベース (hq) にデータをレプリケートする (Interactive SQL の場合)
  1. 現在、リモートデータベース (field) に接続されていない場合は、次のコマンドを実行します。

    dbisql -c "UID=DBA;PWD=sql;SERVER=server_hq;DBF=c:\tutorial\field.db"
  2. 次の文を実行し、リモートデータベース (field) でローを挿入します。

    INSERT INTO Customers ( cust_key, name, rep_key )
    VALUES ( 'cust5', 'North Land Trading', 'rep1' );
    COMMIT;
  3. c:\tutorial ディレクトリから、リモートデータベース (field) に対して dbremote ユーティリティを実行します。

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

    c:\tutorial\hq ディレクトリに、ファイル field.1 が表示されます。

 ♦ 統合データベース (hq) でデータを受信する
  1. 現在、統合データベース (hq) に接続されていない場合は、次のコマンドを実行します。

    dbisql -c "UID=DBA;PWD=sql;SERVER=server_hq;DBF=c:\tutorial\hq.db
    
  2. 統合データベース (hq) でc:\tutorial ディレクトリから Message Agent を実行します。

    dbremote -c "UID=DBA;PWD=sql;SERVER=server_hq;DBF=c:\tutorial\hq.db"
  3. [Message Agent] ウィンドウに 実行が完了しました。 と表示されたら、[シャットダウン] をクリックします。

  4. c:\tutorial\field を参照します。

    hq.1 ファイルは hq.2 というファイルに置き換えられました。hq.2 ファイルは受信確認を含みます。

  5. 次の文を実行して、統合データベース (hq) 内の Customers テーブルのデータを表示します。

    SELECT * FROM Customers;

    このクエリは、次の結果を返します。

    cust_key name rep_key
    cust1 Ocean Sports rep1
    cust2 Sports Plus rep2
    cust3 Land Sports rep1
    cust4 Air Plus rep2
    cust5 North Landing Trading rep1