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

SAP Sybase SQL Anywhere 16.0 » SQL Remote » Tutorial: Creating a SQL Remote system

 

Lesson 6: Sending data from the consolidated database to the remote database

Replicate data from the consolidated database (hq) to the remote database (field) using Interactive SQL.

Prérequis

You must have the SYS_REPLICATION_ADMIN_ROLE system role.

Contexte et remarques

Many.

 Task
  1. If you are not currently connected to the consolidated database (hq), run the following command:

    dbisql -c "UID=DBA;PWD=sql;SERVER=server_hq;DBF=c:\tutorial\hq.db"
  2. Execute the following statements to add sample data to the SalesReps and Customers tables:

    INSERT INTO SalesReps ( rep_key, name )
    VALUES ( 'rep3', 'Example User' );
    
    INSERT INTO Customers ( cust_key, name, rep_key )
    VALUES ( 'cust3', 'Land Sports', 'rep1' );
    INSERT INTO Customers ( cust_key, name, rep_key )
    VALUES ( 'cust4', 'Air Plus', 'rep2' );
    COMMIT;
  3. Execute the following statements to confirm that the data has been entered:

    SELECT * FROM SalesReps;
    SELECT * FROM Customers;
  4. To send the rows to the remote database (field), run the Message Agent on the consolidated database (hq) from the c:\tutorial directory:

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

    This command assumes that the consolidated database (hq) is currently running on the default server. If the database is not running, you must supply a DBF parameter with the database file name instead of the DBN parameter.

  5. When the Message Agent window displays Execution Completed, click Shutdown.

  6. Browse to c:\tutorial\field.

    A file named hq.0 is listed in the directory. This file contains the changes sent from the consolidated database (hq).

Résultat

The sample data is added to the SalesReps and Customers tables and sent from the consolidated database to the remote database.