Lesson 7: Receiving data at the remote database

In this lesson you run the Message Agent on the remote database (field) to receive the data that was sent from the consolidated database (hq).

 Receive data at the remote database (field)
  1. If you are not currently connected to the remote database (field), run the following command:

    dbisql -c "UID=DBA;PWD=sql;SERVER=server_field;DBF=c:\tutorial\field.db"
    
  2. At the remote database (field) run the Message Agent from the c:\tutorial directory:

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

    The c:\tutorial\field\hq.0 file has been replaced by a file named c:\tutorial\hq\field.0. The field.0 file contains the receipt confirmation.

  4. Verify that the remote database (field) contains data,

    1. Execute the following statement to view the contents of the SalesReps table:

      SELECT * FROM SalesReps;

      The SalesReps table contains both rows entered at the consolidated database (hq). This is because the SalesRepData publication included all the data from the SalesReps table.

      rep_key name
      rep1 Field User
      rep2 Another User
      rep3 Example User
    2. Execute the following statement to view the contents of the Customers table:

      SELECT * FROM Customers;

      The Customers table now also contains a row with the Land Sports customer data that was entered at the consolidated database (hq).

      cust_key name rep_key
      cust1 Ocean Sports rep1
      cust3 Land Sports rep1
  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"

    In the c:\tutorial\hq directory, the file field.0 disappears.