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

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

 

Lesson 1: Setting up your MobiLink consolidated database

In this lesson, you create a SQL Anywhere database.

Prerequisites

This lesson assumes that you have installed the required software and completed part one of this tutorial. See Tutorial: Building a BlackBerry application.

Context and remarks

Data synchronization requires a MobiLink consolidated database for the UltraLite database to synchronize with.

 Task
  1. Create a working directory to store the SQL Anywhere database.

    This tutorial assumes that you are working in the c:\HelloBlackBerry\database directory.

  2. Run the following command to create an empty SQL Anywhere database with a DBA user ID of DBA and password of sql:

    dbinit -dba DBA,sql HelloBlackBerry.db
  3. Create an ODBC data source to connect to the database.

    1. Click Start » Programs » SQL Anywhere 16 » Administration Tools » ODBC Data Source Administrator.

    2. Click the User DSN tab, and then click Add.

    3. In the Create New Data Source window, click SQL Anywhere 16 and click Finish.

    4. Click the ODBC tab.

    5. In the Data Source Name field, type HelloBlackBerry.

    6. Click the Login tab.

    7. In the User ID field, type DBA.

    8. In the Password field, type sql.

    9. From the Action list, click Start And Connect To A Database On This Computer.

    10. In the Database File field, type c:\tutorial\database\HelloBlackBerry.db.

    11. In the Server Name fields, type HelloBlackBerry.

    12. Disable the Stop Database After Last Disconnect option.

    13. Click OK.

    14. Click OK on the ODBC Data Source Administrator window.

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

    dbisql -c dsn=HelloBlackBerry
  5. Execute the following SQL statement in Interactive SQL to create the Names table on the consolidated database:

    CREATE TABLE Names (
        ID UNIQUEIDENTIFIER NOT NULL DEFAULT newID(),
        Name varchar(254), 
        PRIMARY KEY (ID)
    )
  6. Close Interactive SQL.

    Click File » Exit.

Results

The SQL Anywhere database is created.