Before you can run the BlackBerry application and synchronize, the MobiLink server must be running. The MDS Simulator must also be running to provide a communication channel between the device simulator and MobiLink.
Start MobiLink by running the following command from c:\HelloBlackBerry\database\:
mlsrv12 -c "DSN=HelloBlackBerry" -v+ -x http(port=8081) -ot ml.mls |
The -c option connects MobiLink to the SQL Anywhere database. The -v+ option sets a high level of verbosity so that you can follow what is happening in the MobiLink server messages window. The -x option indicates the port number being used for the communications. The -ot option specifies that a log file (ml.mls) is to be created in the directory where you started the MobiLink server.
Run the MDS simulator so that the BlackBerry simulator can communicate over a network.
Click Start » Programs » Research In Motion » BlackBerry Email And MDS Services Simulator 4.1.4 » MDS.
Add names to the MobiLink consolidated database so that your application updates the UltraLite Java edition database when synchronizing.
Run the following command to start Interactive SQL and connect to the SQL Anywhere database:
dbisql -c dsn=HelloBlackBerry |
Execute the following SQL statement in Interactive SQL to add names to the Names table:
INSERT Names (Name) VALUES ('Jane Smith'); INSERT Names (Name) VALUES ('David Smith'); COMMIT; |
Close Interactive SQL.
Click File » Exit.
Run the simulator from Eclipse.
In the Package Explorer window, click Application.java, and then click Run » Run As » BlackBerry Simulator.
If multiple projects are open in your workspace, click Run » Run Configurations, select HelloBlackBerry, and then click Run.
The HelloBlackBerry project compiles and then the simulator window appears.
Ensure that the project compiles without errors by selecting the Problems tab in Eclipse.
From the simulator menu, click File » Load Java Program.
Browse to the \UltraLite\UltraLiteJ\BlackBerry4.2\ directory of your SQL Anywhere installation and open the UltraLiteJ12.cod file.
You may need to copy UltraLiteJ12.cod and the DBG files to the working simulator directory (for example, C:\Eclipse\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.0.26\components\simulator\) to run the application. When copied, you do not need to load the Java program from the simulator menu.
From the simulator menu, click Simulate » Set IT Policy.
The Set IT Policy window appears.
In the Policy field, click Allow Third Party Apps To Use Persistent Store » >>.
Click Set and then click Close.
Launch your application.
In the simulator window, navigate to Downloads and then run the HelloBlackBerry application.
A screen appears that displays the Hello BlackBerry title bar, the Status: Connected text, and a Name field.
Synchronize the application with the MobiLink server.
Click *EMPTY* and then choose Sync.
Jane Smith and David Smith appear in the list, which indicates that the application was able to synchronize with the MobiLink consolidated database. If you query the names in the Names table from Interactive SQL, you should see that any names you have entered in the simulator have reached the server.
Stop the simulation.
In the simulator window, click File » Exit.
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |