Advanced Replication Guide : Getting started with data synchronization - evaluation setup : Enabling refresh of data and inserting data in replica
  
Enabling refresh of data and inserting data in replica
The publication defined at the master database must be registered at the replica so that the replica can receive refreshes of data from the master. Updates to data in the replica database are marked for synchronization by using a SAVE statement.
The sample scripts below contain the SQL statements for registering a publication, inserting data in the replica, and saving the data to be propagated to the master.
Registering publications allows publication parameters to be validated. This prevents users from accidentally requesting refreshes they do not want, or requesting ad-hoc refreshes.
1 Query the sample table SYNCDEMO to ensure that it does not contain any data in the master or replica database:
SELECT * FROM SYNCDEMO;
0 rows are returned.
2 Register publication and insert two rows in the replica by running the following statements at the replica:
--*********************************************************
-- replica2.sql
-- This script registers to publication PUB_DEMO, inserts two
-- rows to the REPLICA database and
-- saves the transaction to be propagated to the MASTER
--
-- Execute in the REPLICA database
--*********************************************************
-- register to publication
SET CATALOG sync_demo_catalog ;
MESSAGE REG_PUBL BEGIN;
MESSAGE REG_PUBL APPEND REGISTER PUBLICATION
PUB_DEMO;
MESSAGE REG_PUBL END;
COMMIT WORK;
MESSAGE REG_PUBL FORWARD TIMEOUT FOREVER;
COMMIT WORK;

CALL SYNCDEMO_INSERT (1,1,100,’First row’,
      ’1998-05-15 12:00:00’,’R’);
SAVE CALL SYNCDEMO_INSERT (1,1,100,’First row’,
      ’1998-05-15 12:00:00’,’M’);
CALL SYNCDEMO_INSERT (1,2,101,’Second row’,
      ’1998-05-15 12:00:01’,’R’);
SAVE CALL SYNCDEMO_INSERT (1,2,101,’Second row’,
      ’1998-05-15 12:00:01’,’M’);
COMMIT WORK;
3 Query the sample table SYNCDEMO on the replica to ensure that the replica database contains two rows.
SELECT * FROM SYNCDEMO;
4 Query the sample table SYNCDEMO on the master to ensure that the master database contains 0 rows.
SELECT * FROM SYNCDEMO;
At this point, the replica database also has two saved statements in one transaction waiting to be propagated to the master database.
Fast path: If you are using the working directories and sample scripts in the samples\replication\ directory, go the solidDB® installation root directory and issue the following commands:
.\bin\solsql -O eval.out "tcp 1315" dba dba_password .\samples\ replication\eval_setup\select.sql
.\bin\solsql -O eval.out "tcp 1315" dba dba_password .\samples\ replication\eval_setup\replica2.sql
where:
-O eval.out is an optional parameter that defines the output file for results.
"tcp 1315" is the network protocol and address of the server. You might need to customize this part of the command.
dba and dba_password are username and password respectively.
You can view the results in eval.out with any text editor.
See also
Getting started with data synchronization - evaluation setup