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.

      From the Start menu, choose Programs » SQL Anywhere 11 » SQL Anywhere » ODBC Administrator.

      The ODBC Data Source Administrator window appears.

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

      The Create New Data Source Wizard appears.

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

      The SQL Anywhere 11 ODBC Configuration window appears.

    5. On the Login tab, type DBA as the user ID and SQL as the password.

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

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