Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.1 » UltraLite - Java Programming » Tutorial: Building a BlackBerry application » Part 2: Using MobiLink to synchronize the BlackBerry application


Lesson 4: Starting the MobiLink server and synchronizing the application

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 the MobiLink server and synchronize the application
  1. Start MobiLink by running the following command from c:\HelloBlackBerry\database\:

    mlsrv12 -c "DSN=HelloBlackBerry" -v+ -x http(port=8081) -ot

    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 ( is to be created in the directory where you started the MobiLink server.

  2. 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.

  3. Add names to the MobiLink consolidated database so that your application updates the UltraLite Java edition database when synchronizing.

    1. Run the following command to start Interactive SQL and connect to the SQL Anywhere database:

      dbisql -c dsn=HelloBlackBerry
    2. 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');
    3. Close Interactive SQL.

      Click File » Exit.

  4. Run the simulator from Eclipse.

    In the Package Explorer window, click, 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.

  5. From the simulator menu, click File » Load Java Program.

  6. 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.\components\simulator\) to run the application. When copied, you do not need to load the Java program from the simulator menu.

  7. From the simulator menu, click Simulate » Set IT Policy.

    The Set IT Policy window appears.

  8. In the Policy field, click Allow Third Party Apps To Use Persistent Store » >>.

  9. Click Set and then click Close.

  10. 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.

  11. 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.

  12. Stop the simulation.

    In the simulator window, click File » Exit.