Connecting to an embedded database

An embedded database, designed for use by a single application, runs on the same machine as the application and is largely hidden from the application user.

When an application uses an embedded database, the database is generally not running when the application connects. In this case, you can start the database using the connection string, and by specifying the database file in the DatabaseFile (DBF) parameter of the connection string.

Using the DBF parameter

The DBF parameter specifies which database file to use. The database file automatically loads onto the default server, or starts a server if none is running.

The database unloads when there are no more connections to the database (generally when the application that started the connection disconnects). If the connection started the server, it stops once the database unloads.

The following connection parameters show how to load the demo database as an embedded database:

dbf=path\iqdemo.db
uid=DBA
pwd=sql

where path is the name of your Sybase IQ installation directory.

Using the StartLine (Start) parameter

The following connection parameters show how you can customize the startup of the demo database as an embedded database. This is useful if you wish to use command-line options, such as the cache size:

Start=start_iq -gd all
-gl all -gm 10 -gn 25 -gp 4096 -c 32M 
-ti 4400 -tl 300
dbf=path\iqdemo.db
uid=DBA
pwd=sql

Example: connecting from Interactive SQL

In this example, the demo database is an embedded database within Interactive SQL.

StepsConnecting to an embedded database from Interactive SQL in Windows

  1. Start Interactive SQL with no databases running. You can use either of the following ways:

    • From the Windows Programs menu, choose Sybase > Sybase IQ 15.2 > Interactive SQL, or,

    • Type dbisql at a system command prompt.

    When Interactive SQL starts, it is not connected to any database.

  2. Type CONNECT in the command window, and press F9 to execute the command. The connection dialog appears.

  3. If you have an ODBC data source for your database, select that data source.

  4. Enter DBA as the user ID and sql as the password. Then click the Database tab. Enter the full path of the demo database in the Database File field. For example, if your installation directory is c:\sybase\IQ-15_2, enter:

    c:\sybase\IQ-15_2\iqdemo.db
    
  5. Leave all other fields blank, and click OK. Sybase IQ starts up and loads the demo database, and Interactive SQL connects to the database.