[Home] [Table of Contents] [Previous Section] [Next Section]
Breck Carter
Last modified: October 21, 1999
mail to: bcarter@bcarter.com


Tip 90: UltraLite Lite


5 - Create the Reference and Consolidated Database

  1. You can have three different databases when using UltraLite:

    • The embedded database sits on your Palm device, and it's where the word UltraLite comes from. This database uses Adaptive Server Anywhere (also known as ASA, or SQL Anywhere).

    • The reference database sits on your desktop, and it exists only for the purposes of developing and compiling your UltraLite application. This database must also use ASA.

    • The consolidated database sits on your desktop or server, and it's the master copy or central database that is synchronized with the embedded database at run-time. This database can use ASA but it doesn't have to: it can use Oracle or SQL Server, for example.

    For this application, just to keep things simple, we're only going to use two databases: the embedded database on the Palm, and a combined reference and consolidated database on the desktop.

    At this point, if you haven't done so already, create a master directory (folder) to hold the database and other project files. This article is using c:\amisc\ull where "ull" stands for "UltraLite Lite".

    The following batch file run_ASA6_dbinit_on_ulldemo1.bat automates the creation of the reference/consolidated database.

    SET ASA=E:\Program Files\Sybase\Adaptive Server Anywhere 6.0\win32
    SET DB=c:\amisc\ull
    
    rem -n no transaction log
    rem -p page size
    
    "%ASA%\dbinit.exe" -n -p 4096 "%DB%\ulldemo1.db"
    


  2. The next batch file run_ASA6_dbsrv6_on_ulldemo1.bat starts the ASA database server with a cache of 10M and explicit server name and database name parameters (both "ulldemo1").

    Warning! One of the lines in this batch file has been wrapped to fit on the screen.

    SET ASA=E:\Program Files\Sybase\Adaptive Server Anywhere 6.0\win32
    SET DB=c:\amisc\ull
    
    rem -c initial cache size
    rem -gp maximum page size
    rem -n server name
    rem -x communication links
    rem -n database name
    
    "%ASA%\dbsrv6.exe" -c 10m -gp 4096 -n ulldemo1 -x none 
      "%DB%\ulldemo1.db" -n ulldemo1
    


  3. You can use the following batch file run_ASA6_dbisql_on_ulldemo1.bat to connect to the database via DBISQL.

    Ooops! This batch file assumes an ODBC Data Source has already been set up, but that isn't described until the next section: Section 6 - Configure the ODBC Data Source.

    SET ASA=E:\Program Files\Sybase\Adaptive Server Anywhere 6.0\win32
    
    rem -c connection parameters
    
    "%ASA%\dbisql.exe" -c "DSN=ulldemo1"
    
    pause
    exit
    


  4. You can run the following file create_table_ulldemo1.sql via DBISQL to create the one table used in this application.

    IF EXISTS ( 
       SELECT * 
         FROM sys.systable
        WHERE sys.systable.table_name = 'ULLDemo1'
          AND sys.systable.table_type = 'BASE'
          AND user_name ( sys.systable.creator ) = CURRENT USER )
    THEN 
       DROP TABLE ULLDemo1;
    END IF;
    
    CREATE TABLE ULLDemo1
       ( pkey    INTEGER NOT NULL,
         field   CHAR ( 100 ) NOT NULL DEFAULT '',
         PRIMARY KEY ( pkey ) );
    
    INSERT INTO ULLDemo1 VALUES ( 1, 'hello, world' );
    



[Home] [Table of Contents] [Previous Section] [Next Section] [mail to: bcarter@bcarter.com]