Embedded database connections

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

When an application uses an embedded database, the personal server is generally not running when the application connects.
The database is started using a connection string, and by specifying the database file in the DatabaseFile (DBF) parameter
of the connection string.

To improve query performance for databases that are started automatically, start the database as soon as possible, even if
users are not connecting right away. This allows the cache to warm before queries are executed against the database. See Cache warming.

When using an embedded database, use the ServerName (Server) connection parameter. This ensures that the database connects
to the correct database server if there are other applications running SQL Anywhere database servers on the same computer.

If the database server has an alternate server name, the client application can only use the alternate server name to connect
to the database that specified the alternate server name. You cannot use the alternate server name to connect to any other
databases running on that database server. See -sn dbsrv12 database option.

The DBF connection parameter specifies the database file to use. The database file automatically starts on the database server
matching the ServerName connection parameter (if it is not already running) and a database server is automatically started
(if it is not already running).

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

In the following example, the sample database is started as an embedded database:

The following connection parameters show you how to customize the startup of the sample database as an embedded database.
The StartLine connection parameter is useful if you want to use database server options. For example:

To prevent users from starting or stopping the embedded database, or starting other databases on the database server, set
the -gd option to none. See -gd dbeng12/dbsrv12 server option.

There are many connection parameters that affect how a database server is started. It is recommended that you use the following
connection parameters instead of providing the corresponding server options within the StartLine (START) connection parameter:

If you are automatically starting a database server on Windows Vista, you must specify ELEVATE=YES in your connection string
so that the database server executables are elevated. On Windows Vista, only elevated database servers can use AWE memory
or call procedures as an administrator user.

Note

The use of AWE is deprecated. It is recommended that you use the 64-bit version of the SQL Anywhere database server on a 64-bit
Windows operating system if you require a large cache.