Lesson 5: Set up a remote database

In this lesson, you create a SQL Anywhere remote database, create a synchronization publication, a user, and a subscription. You also create the command file for the Listener, and then start the Listener.

To create and set up a new SQL Anywhere remote database
  1. At a command prompt, navigate to the directory where you want to create the database.

  2. Type the following command to create the database:

    dbinit c:\MLsis\SIS_CarDealer_LP_DBLSN_REM.db
  3. Type the following command to start the database:

    dbeng11 c:\MLsis\SIS_CarDealer_LP_DBLSN_REM.db
  4. Generate the remote database schema.

    1. Click Start » Programs » SQL Anywhere 11 » Sybase Central.

    2. In the left pane, click SQL Anywhere 11.

    3. Click File » Connect.

    4. Click the Identification tab.

    5. In the User ID field, type DBA.

    6. In the Password field, type sql.

    7. Click the Database tab.

    8. In the Server Name field, type SIS_CarDealer_LP_DBLSN_REM.

    9. Click OK.

    10. Click File » Open Interactive SQL.

    11. Execute the following command to create the Dealer table:

      CREATE TABLE Dealer (
          name           VARCHAR(10) NOT NULL PRIMARY KEY,
          rating         VARCHAR(5),
          last_modified  TIMESTAMP DEFAULT TIMESTAMP
      )
      COMMIT;
  5. Execute the following commands to create a synchronization publication, user, and subscription:

    CREATE PUBLICATION CarDealer(TABLE DEALER WHERE 0=1)
    CREATE SYNCHRONIZATION USER test_mluser OPTION ScriptVersion='CarDealer'
    CREATE SYNCHRONIZATION SUBSCRIPTION TO CarDealer FOR test_mluser
    SET OPTION public.ml_remote_id = {remote_id}
    COMMIT;
See also