Sybase Business Intelligence Solutions - Database Management, Data Warehousing Software, Mobile Enterprise Applications and Messaging
Sybase Brand Color Bar

Search for    in all of
view all search results right arrow
Downloads > Code Samples & Utilities > UltraLite Database Management Tutorial  
RSS Feed

UltraLite Database Management Tutorial

You can now work with UltraLite databases just like you can work with SQL Anywhere databases, making the design and development of UltraLite applications easier than ever. This tutorial points you to the places in Sybase Central where you can carry out common UltraLite tasks.

For more information about the UltraLite plug-in for Sybase Central, refer to the online documentation: SQL Anywhere 10 Help | SQL Anywhere UltraLite Help.


  • SQL Anywhere 10.0

You can run this sample under Windows only.


Create an UltraLite database

  1. Start Sybase Central. From the Start menu, choose Programs | SQL Anywhere 10 | Sybase Central.
  2. In the tasks list, click Create a database. If you do not see a list of tasks on the left pane, click the Tasks button on the toolbar.

    If the wizard Welcome page appears, click Next.
  3. Select Windows desktop and Symbian OS as the target platforms. UltraLite databases are portable subject to operating system limitations.

  4. Click Next. Save the database file as ul_custdb.udb in a temporary directory.

    Click Finish to create the database. If necessary, click Close when the operation completes. Sybase Central connects to the UltraLite database.
  5. Copy table definitions from a SQL Anywhere database

  6. Connect to the SQL Anywhere 10 CustDB sample database:
    • Switch to the Folders view and right-click on SQL Anywhere 10.

    • From the popup menu, select Connect.
    • Select ODBC Data Source name and browse to SQL Anywhere 10 CustDB.

    • Click OK. Sybase Central connects to the CustDB sample database. If you are asked to include the ml_server owned objects, click Yes.
  7. Open the Tables folder, showing the tables owned by ml_server in the right pane.
  8. While holding the Ctrl key, click the ULCustomer, ULOrder, and ULProduct tables.

  9. From the Edit menu, choose Copy.
  10. In the toolbar, click the Back button until you are at the UltraLite database.
  11. Open the Tables folder and from the Edit menu choose Paste.

    Some warnings are displayed for columns where UltraLite does not support the full SQL Anywhere definition. Click Continue when these warnings appear and click OK to create the tables.
  12. We need to remove the column "last_modified" from the ULCustomer and ULOrder tables. In the left pane, expand Tables and select the ULCustomer table. Now on the right pane select the last_modified column.

  13. Right-click the selection and choose Delete from the popup menu.
  14. Now switch to the ULOrder table by clicking its name on the left pane. If you see a message asking to save the changes, click Yes.
  15. You will see the columns of the ULOrder table on the right pane. Select the last_modified column, right-click the selection and choose Delete from the popup menu.
  16. Click the Save Table button on the toolbar to accept the changes.

  17. Create foreign keys

  18. The UltraLite database does not contain foreign key definitions. To see this, open the UltraLite ul_custdb database and click the ER Diagram tab to show the tables in the database. There are no foreign key lines joining the tables.

  19. Create a foreign key from the ULOrder table (using cust_id as the foreign key column) to the ULCustomer table (where cust_id is the primary key):
    • Open the UltraLite ul_custdb database, then open the Tables folder, and then open the ULOrder table.

    • Click the Foreign Keys tab, and then choose File | New | Foreign Key.  The Foreign Key wizard appears.
    • Click the ULCustomer table, and then click Next.

    • Accept the default reference columns, and click Finish to create the foreign key.

      Notice the change in the ER diagram; a link is present between the ULOrder and the ULCustomer tables, indicating that a foreign key has been added.
  20. Synchronize the database

  21. Open a Command Prompt and start the MobiLink synchronization server by issuing the following command:
    mlsrv10 -v+ -zu+ -c "dsn=SQL Anywhere 10 CustDB"

  22. From Sybase Central, click the Contents tab and then right-click on the UltraLite ul_custdb.udb database. Choose Synchronize Database from the popup menu.

  23. The Synchronization wizard appears. Click Next on the welcome page.
  24. On the Database to synchronize page, choose the database you are currently connected to. Click Next.

  25. On the Synchronization parameters page, enter the following values:
    • Version: custdb 10.0
    • User name: 50
    • Password: 50
    • On the Synchronization data page, click Finish to synchronize.
    • When the synchronization completes successfully, click Close.
    • View the synchronized data in the UltraLite database

    • Select the ULProduct table in the left pane.
    • Click the Data tab in the right pane. The contents of the table are displayed in the grid.

    • You can also see the contents of the ULCustomer and ULOrder tables. The data in all these tables was synchronized from the consolidated database.
      You can also start Interactive SQL and connect to the ul_custdb.udb database and query the data.
    • This completes the tutorial. You may now shut down the MobiLink synchronization server and Sybase Central.

    Click Next.


  • Remove the file ul_custdb.udb from the temporary directory you specified in step 2 of the walkthrough.


SQL Anywhere

The industry-leading mobile and embedded database that provides data management and synchronization technologies for applications outside the data center.


© Copyright 2014, Sybase Inc. - v 7.6 Home / Contact Us / Help / Jobs / Legal / Privacy / Code of Ethics