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: Setting up a replication system using the HTTP message system with the consolidated database as the message server

 

Lesson 3: Creating the remote database

Extract the remote database, and then replace the FILE message system at the remote database with the HTTP message system.

Prérequis

You must have the SYS_REPLICATION_ADMIN_ROLE system role.

 Task
  1. From the c:\tutorial\rem directory, run the following command to create the remote database (rem):

    dbinit -dba DBA,sql rem.db
  2. Start the consolidated database:

    dbeng16 -n rem c:\tutorial\rem\rem.db
  3. In this lesson, you use dbxtract to create the remote database. Run the following command to extract the database for the rem user from the consolidated database, and leave the database server for the remote database running after the extraction:

    dbxtract -xx -ac "SERVER=rem;DBN=rem;dbf=c:\tutorial\rem\rem.db;UID=DBA;PWD=sql;autostop=no" -c "SERVER=cons;DBN=cons;UID=DBA;PWD=sql" rem

    If you are not currently connected to the remote database (rem), run the following command:

     dbisql -c "SERVER=rem;DBN=rem;UID=DBA;PWD=sql"
  4. The consolidated database uses the FILE message system, so when dbxtract runs, it creates SQL Remote definitions assuming that the rem remote database also uses the FILE message system. To set the remote database to use the HTTP message system, execute the following statements on the remote database (rem) to remove the FILE message system for this remote database:

    CREATE REMOTE TYPE "FILE" ADDRESS '';
    SET REMOTE FILE OPTION public.directory='';
    SET REMOTE FILE OPTION public.debug=''; 
  5. Execute the following statements on the remote database (rem) to configure the HTTP message system for this remote database:

    CREATE REMOTE TYPE "HTTP" ADDRESS 'rem';
    GRANT CONSOLIDATE TO "cons" TYPE "HTTP" ADDRESS 'cons';
    SET REMOTE HTTP OPTION public.user_name='rem';
    SET REMOTE HTTP OPTION public.password='rem';
    SET REMOTE HTTP OPTION public.debug='yes';
    SET REMOTE HTTP OPTION public.https='no';
    SET REMOTE HTTP OPTION public.url='localhost:8033';
    COMMIT;
  6. Verify that the employees table in the remote database (rem) contains the two rows of data that existed in the consolidated database after the extraction. Execute the following statement to view the contents of the employees table:

    SELECT * FROM employees

    The query returns the following data from the employees table, although the hire_date column contains the time you inserted the row, and not the data you see in the following table:

    employee_id first_name last_name hire_date
    1 Kelly Meloy 2011-03-25 08:27:56.310
    2 Melisa Boysen 2011-03-25 08:27:56.310
  7. Disconnect from Interactive SQL.

Résultat

The remote database is extracted and the FILE message system at the remote database is replaced with the HTTP message system.