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:
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.
To create an UltraLite database from the sample
ASA database:
In the System Tree, select the dwexam target and select Run from its pop-up menu.
In the Database Connection dialog box, select ODBC from the DBMS drop-down list, click OK, then click Yes when prompted to connect.
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.
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.
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.
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.
To run the MobiLink Synchronization for UltraLite
wizard:
In the ODBC ASA 9.0 Sample window, select File>DB Connection.
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.
In PocketBuilder, select UltraLite Synchronization from the Database page of the New dialog box.
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 |
Running the MobiLink Synchronization wizard creates new objects that you use to synchronize the database.
To create an UltraLite database profile and synchronize
the database:
In the Database profiles dialog box, select UL9, click New, and create a new database profile with the name DWExamUL9.
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.
Click OK, close the Database profiles dialog box, and run the DWExam target again.
Connect to the UL9 database and select File>UltraLite Setup again.
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.
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.
When you have finished testing the application in the development environment, you can deploy it to a Windows CE device.
To deploy the application to a Windows CE device:
Close the running application and double-click the nvo_dwexam_ulsync object in the PocketBuilder System Tree.
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.
Open the p_dwexam project and deploy the target to your Windows CE device.
Copy the uldemo.db to your Windows CE device and run the application.
Copyright © 2004. Sybase Inc. All rights reserved. |
![]() |