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 sample database as an embedded database:

dbf=path\asiqdemo.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 sample database as an embedded database. This is useful if you wish to use command-line options, such as the cache size:

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

Example: connecting from DBISQL

In this example, the sample database is an embedded database within DBISQL.

StepsConnecting to an embedded database from DBISQL in Windows

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

    • From the Windows Programs menu, choose Sybase > Adaptive Server IQ 12.6 > Interactive SQL Java.

    • Type dbisql at a system command prompt.

    When DBISQL 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 sample database in the Database File field. For example, if your installation directory is c:\sybase\ASIQ-12_6 you should enter the following:

    c:\sybase\ASIQ-12_6\asiqdemo.db
    
  5. Leave all other fields blank, and click OK. Sybase IQ starts up and loads the sample database, and DBISQL connects to the database.