Contents Index Explanation of the sample program Adding synchronization to your application pdf/preface.pdf

UltraLite User's Guide
  Tutorial: Build an Application Using Embedded SQL

Building the sample embedded SQL UltraLite application


After you have created a source file sample.sqc using the sample code in the previous section, you are ready to build your UltraLite application. Follow these steps in Microsoft Visual C++ 6.0 to create the sample embedded SQL UltraLite application.

To build the sample embedded SQL UltraLite application

  1. Start the Adaptive Server Anywhere personal database server.

    By starting the database server, both the SQL preprocessor and the UltraLite analyzer will have access to your reference database. The sample application uses the CustDB sample database custdb.db as a reference database and as consolidated database. Start the database server at the command line from the Samples\UltraLite\CusDB directory containing custdb.db as follows:

    dbeng9.exe custdb.db

    Alternatively, you can start the database server by selecting Start > Programs > SQL Anywhere 9 > UltraLite > Personal Server Sample for UltraLite.

  2. Start Microsoft Visual C++ from your desktop in the standard fashion.

  3. Configure Visual C++ to search the appropriate directories for Embedded SQL header files and UltraLite library files.

    Select Tools > Options and click on the Directories tab. Choose Include Files under the Show Directories For drop down menu. Include the following directory, so that the embedded SQL header files can be accessed.

    C:\Program Files\Sybase\SQL Anywhere 9\h

    If you have installed SQL Anywhere to a directory other than the default, substitute your installation directory above. On the same tab, select Library Files under the Show Directories For drop down menu. Include the following directory so that the UltraLite library files can be accessed.

    C:\Program Files\Sybase\SQL Anywhere 8\UltraLite\win32\386\lib

    Click OK to submit the changes.

  4. Create a new workspace tutorial:

  5. Create a new project ultutorial and add it to the tutorial workspace:

  6. Add the sample.sqc embedded SQL source file to the project:

  7. Configure the sample.sqc source file settings to invoke the SQL preprocessor to preprocess the source file:

    Because the sample application consists of only one source file, the preprocessor automatically runs the UltraLite analyzer as well and appends extra C/C++ code to the generated source file.

  8. Preprocess the sample.sqc file:

  9. Add the sample.cpp file to the project:

  10. Configure the project settings:

  11. Build the executable:

  12. Run the application:


Adding synchronization to your application

Contents Index Explanation of the sample program Adding synchronization to your application pdf/preface.pdf