Lesson 1: Create a SQL Anywhere database

Data synchronization requires a consolidated database for UltraLiteJ to synchronize with. In this lesson, you create a SQL Anywhere database.

  1. In your application directory, create a subdirectory to hold the SQL Anywhere database called c:\tutorial\database.

  2. Run the following command from c:\tutorial\database to create an empty SQL Anywhere database:

    dbinit HelloBlackBerry.db
  3. Create an ODBC data source to connect to the database.

    1. Open the ODBC Administrator.

      Choose Start » Programs » SQL Anywhere 11 » ODBC Administrator.

    2. Click the User DSN tab to create an ODBC data source for the current user.

    3. Click Add.

    4. From the list of drivers, choose SQL Anywhere 11, and then click Finish.

    5. Click the ODBC tab.

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

    7. Click the Login tab.

    8. In the User ID field, type DBA and in the Password field type SQL.

      These are the default login name and password for all SQL Anywhere databases, and should not be used in a production environment.

    9. Click the Database tab, type HelloBlackBerry as the Server Name and c:\tutorial\database\HelloBlackBerry.db as the Database File. Click OK.

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

    dbisql -c dsn=HelloBlackBerry
  5. Execute the following statement to create a table in the database:

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