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 8: Sending data from the remote database to the consolidated database

Replicate data from the remote database (field) to the consolidated database (hq) 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 remote database (field), run the following command:

    dbisql -c "UID=DBA;PWD=sql;SERVER=server_hq;DBF=c:\tutorial\field.db"
  2. Execute the following statement to insert a row at the remote database (field):

    INSERT INTO Customers ( cust_key, name, rep_key )
    VALUES ( 'cust5', 'North Land Trading', 'rep1' );
    COMMIT;
  3. From the c:\tutorial directory, run the dbremote utility against the remote database (field):

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

    In the c:\tutorial\hq directory, the file field.1 appears.

  4. 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
    
  5. At the consolidated database (hq) run the Message Agent from the c:\tutorial directory:

    dbremote -c "UID=DBA;PWD=sql;SERVER=server_hq;DBF=c:\tutorial\hq.db"
  6. When the Message Agent window displays Execution Completed, click Shutdown.

  7. Browse to c:\tutorial\field.

    The hq.1 file has been replaced by a file named hq.2. The hq.2 file contains the receipt confirmation.

  8. Execute the following statement to view the data in the Customers table in the consolidated database (hq):

    SELECT * FROM Customers;

    This query returns the following results:

    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

Résultat

The data is replicated from the remote database to the consolidated database.

Suivant

None.