Preparing to use the wizard for remote UltraLite databases  Preparing consolidated databases

Chapter 17: Using MobiLink Synchronization

UltraLite synchronization sample

The DWExam target in the Code Examples\DataWindows directory installed with PocketBuilder lets you connect to an ASA or UltraLite database and view various types of DataWindow presentation styles and capabilities, including graphing. It also has a menu item that lets you create an UltraLite database from the ASA sample database.

Use this example to understand how to add a publication to an ASA database, create an UltraLite database using the ASA database as a reference, connect to the UltraLite database, use the MobiLink Synchronization wizard to create the objects that help you synchronize the database, and deploy the application. You can examine the code in the functions and objects to understand how the process works.

The following procedures break the example down into four stages:

Create an UltraLite database from an ASA database

The example adds a publication to the sample database installed with ASA, then uses the utilities installed with UltraLite to create an UltraLite schema and database.

StepsTo create an UltraLite database from the sample ASA database:

  1. In the System Tree, select the dwexam target and select Run from its pop-up menu.

  2. In the Database Connection dialog box, select ODBC from the DBMS drop-down list, click OK, then click Yes when prompted to connect.

  3. Select File>UltraLite Setup, then select the Create Publication in ASA 9.0 Sample check box in the UltraLite Setup window.

    This invokes the gf_create_dwexam_publication global function to create a publication called DWEXAM in the ASA sample database.

  4. Select the Run Ulinit to Create UltraLite Schema check box in the UltraLite Setup window.

    This invokes the gf_create_ulschema global function, which uses the Run function to launch the UltraLite ulinit utility with appropriate command-line arguments. The ulinit utility creates a database schema file called uldemo.usm in the same directory as the asademo.db file, typically Program Files\Sybase\SQL Anywhere 9.

  5. Select the Create UltraLite Database From Schema check box in the UltraLite Setup window.

    This invokes the gf_create_udb global function, which uses the Run function to launch the UltraLite ulconv utility with appropriate command-line arguments. The ulconv utility creates an UltraLite database file called uldemo.udb in the same directory as the uldemo.usm file.

Run the MobiLink Synchronization wizard

Control returns to the UltraLite Setup window, but do not select the next check box yet. First you need to connect to the new UltraLite database.

StepsTo run the MobiLink Synchronization for UltraLite wizard:

  1. In the ODBC ASA 9.0 Sample window, select File>DB Connection.

  2. In the Database Connection window, select UL9 from the DBMS drop-down list and click OK to connect to the database.

    Notice that the value of the ConnectString parameter changes to show a DBF value set to the file location and name of the new uldemo.db database.

  3. In PocketBuilder, select UltraLite Synchronization from the Database page of the New dialog box.

  4. In the MobiLink Synchronization for UltraLite wizard, make the following selections, accept the default selections on the remaining wizard pages, and click Finish:

    Option

    Setting

    Destination Library

    dwexam.pkl

    Publication

    dwexam

    Script Version

    ul_default

    Send Column Names

    Check the box

    Protocol

    TCPIP

Connect to the new database and synchronize

Running the MobiLink Synchronization wizard creates new objects that you use to synchronize the database.

StepsTo create an UltraLite database profile and synchronize the database:

  1. In the Database profiles dialog box, select UL9, click New, and create a new database profile with the name DWExamUL9.

  2. Click Browse to navigate to the location of the uldemo.db file, enter DBA as the User ID and SQL as the Password, and click Apply.

    This sets the value of the ConnectString database parameter. You can check its value and test the connection on the Preview tab page.

  3. Click OK, close the Database profiles dialog box, and run the DWExam target again.

  4. Connect to the UL9 database and select File>UltraLite Setup again.

  5. In the UltraLite Setup dialog box, select the Start the MobiLink Synchronization Server check box.

    This invokes the gf_start_dwexam_dbmlsrv global function to start the MobiLink server.

  6. Select the Synchronize the New UltraLite Database check box.

    This invokes the gf_dwexam_ulsync global function to synchronize the database. When synchronization completes, you can return to the main window and select items from the DataWindow and Graph DWs menus to test the DataWindow functionality.

Deploy to Windows CE

When you have finished testing the application in the development environment, you can deploy it to a Windows CE device.

StepsTo deploy the application to a Windows CE device:

  1. Close the running application and double-click the nvo_dwexam_ulsync object in the PocketBuilder System Tree.

  2. On the Declare Instance Variables page in the Script view, locate the declaration of the string is_host and change its value from an empty string to the numeric IP address of the host that is running the MobiLink server.

    You can use the ping command at a command prompt to get the numeric address of the server if you know its host name.

  3. Open the p_dwexam project and deploy the target to your Windows CE device.

  4. Copy the uldemo.db to your Windows CE device and run the application.





Copyright © 2004. Sybase Inc. All rights reserved. Preparing consolidated databases

View this book as PDF