Lesson 2: Generate database schema

The consolidated database schema includes a Dealer table, a download_cursor synchronization script, and a table and stored procedure to generate server-initiated synchronization push requests.

To add the Dealer table and download_cursor synchronization script
  1. Connect to the consolidated database:

    1. In Sybase Central, right-click SQL Anywhere 11 and choose Connect.

    2. Click the Identification tab.

    3. Click ODBC Data Source Name, and type sis_cons. Click OK.

  2. Start Interactive SQL.

    In the left pane, right-click the database and choose Open Interactive SQL.

  3. Execute the following statement to install the Dealer table and download_cursor synchronization script.

    CREATE TABLE Dealer (
        name varchar(10) NOT NULL PRIMARY KEY,
        rating VARCHAR(5),
        last_modified TIMESTAMP DEFAULT TIMESTAMP
    )
    INSERT INTO Dealer(name, rating) VALUES ('Audi', 'a');
    INSERT INTO Dealer(name, rating) VALUES ('Buick', 'b');
    INSERT INTO Dealer(name, rating) VALUES ('Chrysler', 'c');
    INSERT INTO Dealer(name, rating) VALUES ('Dodge', 'd');
    INSERT INTO Dealer(name, rating) VALUES ('Eagle', 'e');
    INSERT INTO Dealer(name, rating) VALUES ('Ford', 'f');
    INSERT INTO Dealer(name, rating) VALUES ('Geo', 'g');
    INSERT INTO Dealer(name, rating) VALUES ('Honda', 'h');
    INSERT INTO Dealer(name, rating) VALUES ('Isuzu', 'I');
    COMMIT;
  4. Execute the following command to create the MobiLink system tables and stored procedures. Replace c:\Program Files\SQL Anywhere 11\ with the location of your SQL Anywhere 11 installation.

    read "c:\Program Files\SQL Anywhere 11\MobiLink\setup\syncsa.sql"
  5. Execute the following commands:

    CALL ml_add_table_script(
        'sis_ver1',
        'Dealer',
        'download_cursor',
        'SELECT * FROM Dealer WHERE last_modified >= ?'
    )
See also