Page tree
Skip to end of metadata
Go to start of metadata

Purpose

The purpose of this page is to clarify how databases and servers are assigned their names. As well, the dbeng16 command and -n switch are discussed.

Overview

When a database server (sometimes referred to as the database engine) is started, it is always given a name in the process of starting up. You can use the -n command-line option as a server switch to name the server, or as a database switch to name the database. Note that the meaning of this switch does depend on its position. The server and database names are among the connection parameters that client applications may use when connecting to the database. The server name appears on the desktop icon and on the title bar of the server window.

The Importance of Naming the SQL Anywhere Database Server

In every SAP SQL Anywhere database system, there has to be a database server which manages the database. No other applications access the database file directly and instead communicate through the database server. Because of this fact, addressing the server as an exclusive communication portal to the database is required since without the database server access, the database is inaccessible.

Providing a database server name avoids conflicts with other server names on your network, or to provide a meaningful name for users of client applications. The server keeps its name for its entire lifetime (until it is shut down).

How the Database Server is Assigned a Name

The server can be named by supplying a positional -n database server switch before the first database file. For example, the following command line starts a server with the demo database mounted, and names the server Test.

dbeng16 -n Test demo.db

If you wish to start a database server without a database, you have to name the server directly. The following command starts a sever named Test without a database started.

dbeng16 -n Test

If you don't explicitly provide a name, the server is given the name of the first database started. In the following command, the server is left unnamed by the user. By default, the server will be given the name demo. When the servers are not given a name when started, they accept the name of the database file, without the .db extension.

dbeng16 demo.db

As a second example, consider the following command that starts two databases on the same server:

dbeng16 first_database.db second_database.db

Since the server takes the name of the first database started, in this example, the server name will be first_database.

How the Database is Assigned a Name

The -n database switch can be specified after the database file name to name the database. You may want to give the database a name that is easily recognizable to users, and this can be done by explicitly naming the database when it is mounted on the server.

When you start a database with a server, there are three names involved, namely the database filename (dbf), the database name (dbn), and the server name (server, previously 'eng'). Consider the following example: You have a database, xxx.db, which you startup on a server with the following command.

dbeng16 xxx.db

Since a name has not been specified for the database, the database accepts the name xxx. Because the server's name has not been specified, it accepts the database's name and is also called xxx. In terms of the connection parameters required to connect to the database, the following values result from this situation:

dbf = xxx.db

dbn = xxx

server = xxx

You can name databases by supplying a -n switch following the database file. For instance, using the previous scenario, consider the following command instead.

dbeng16 xxx.db -n Data

Here, a name has been given to the database, namely Data. Because the server has not been named, it accepts the database's name, and is also called Data. In this case, the connection parameters appear as the following:

dbf = xxx.db

dbn = Data

server = Data

Finally, consider the situation where the -n switch is used to specify both the server and database names. When the -n switch is located before the database filename in the command, it names the server; when it is located after the database filename, it names the database.

dbeng16 -n MyServer xxx.db -n MyDatabase

In this example, the server is given a name, MyServer, and the database is explicitly named also, namely MyDatabase. In terms of connection parameters:

dbf = xxx.db

dbn = MyDatabase

server = MyServer

Related Content

Related Documents

Related SAP Notes/KBAs

 

  • No labels