Before an application can be deployed, a project is needed to specify how the application is deployed.
Select File>New.
In the Project tab, select Application and click OK.
The Project painter displays. The default executable file name is salesdb_tutorial.exe.
Pocket PC Device (ARM) is the platform for deployment to an ARM device. Use the default \Program Files location for deployment to the device. For your own applications, you might want to deploy to an application-specific directory that you create.
Select the Add Shortcut to “Start Menu” check box to add a Start menu item for the deployed application on the device.
Select File>Save to save the project.
Type p_salesdb_tutorial for the project name and click OK.
Before you can deploy SalesDB to a device or emulator, you must deploy the the local copy of the remote database and the DSN file to the Pocket PC or emulator. You do that next.
Now you copy the remote database and log file to the Pocket PC. You copy the log file because synchronization subscriptions were added to the remote database during the initialization phase. Synchronization subscriptions can also be added during the first execution of the application. When adding the subscriptions at runtime, you need to deploy only the database file to the device, not the log file.
On your desktop machine, use a text editor to open SalesDB_remote.dsn in the \Tutorial\SalesDB directory.
Make sure that the paths for the database file and the start line (set to the default location) are correct for your Pocket PC device.
Since you are using SQL Anywhere 10 on the device, you must add the following line:
driver = dbodbc10.dll
You will also need to change the database file and start directories:
databasefile=\Program Files\SQLAny10\SalesDB_remote.db
start=\Program Files\SQLAny10\dbsrv10.exe
Open ActiveSync while a connection to the device is established.
Click Explore in the ActiveSync toolbar.
Double-click My Pocket PC.
My Pocket PC is the root directory on the Pocket PC device.
Open another Windows Explorer window.
Copy SalesDB_remote.DSN from your PocketBuilder 2.0 Tutorial\SalesDB directory to the root directory on your Pocket PC device (My Pocket PC or My Device).
You can drag and drop files from the desktop to the Pocket PC in the same way that you drag and drop files from one directory to another on the Windows desktop.
In the Explorer window for your device, go to the \Program Files\SQLAny10 directory.
This is the default directory for SQL Anywhere 10 on a Pocket PC. If you installed SQL Anywhere in a different directory, be sure to use that directory instead.
Locate the \Tutorial\SalesDB\db\fresh directory on your desktop.
Copy SalesDB_remote.db and SalesDB_remote.log to the SQL Anywhere 10 directory on your device.
Now you can build the application and deploy it to a device or emulator by running the project object you created in “Create a project” of this lesson. However, because the registry location for SQL Anywhere 10 is not the same as the registry location on the device, you must first modify the registry path that you generated with the MobiLink Synchronization for ASA wizard.
In the PocketBuilder System Tree, double-click the nvo_salesdb_tutorial_sync user object that you generated with the MobiLink Synchronization for ASA wizard.
The User Object painter opens.
Click the Function List tab in the main stack view of the User Object painter.
Double-click “determine_asa_regpath () returns integer” in the functions list.
The script for determining the SQL Anywhere registry path displays. Script constants display the registry path for the 8, 9, and 10 versions of the database server. In the MobiLink Synchronization for ASA wizard, you selected 10 as the server version. You can verify this by selecting the Declare Instance Variables tab and examining the value of the is_mlserverversion variable.
Comment out the constant string that sets the registry path for SQL Anywhere 10.
The path assigned by the wizard (“HKEY_LOCAL_MACHINE\Software\Sybase\SQL Anywhere\10.0”) is valid on the desktop, but not on the device.
To comment out this string, you can add two forward slashes
(//
) in front of
the line that starts: constant string ASA10_REGPATH =
.
Add the following assignment after the line you just commented out:
constant string ASA10_REGPATH = HKEY_CURRENT_USER\Software\Sybase\SQL Anywhere\10.0
This line assigns the ASA10_REGPATH variable to “HKEY_CURRENT_USER\Software\Sybase\SQL Anywhere\10.0”
This is the registry path used on the device for SQL Anywhere.
Save your changes and close the User Object painter.
Double-click the p_salesdb_tutorial project object in the System Tree.
The Project painter opens.
Select Run>Build and Deploy Workspace or click the Deploy button on the PainterBar.
The project is built and deployed and the application is copied to the device’s \Program Files directory.
Next you run the application on the Pocket PC device.