Icon Configuring and Starting the Server

Introduction
There are no extra steps required in order to use the TDBISAMEngine component in DBISAM as a client engine since the default value of the EngineType property is etClient. However, in order to use the TDBISAMEngine component in DBISAM as a database server you will need to make some property changes before starting the engine.

Configuration Properties
The TDBISAMEngine component has several key properties that are used to configure the database server, which are described below in order of importance:

PropertyDescription
EngineTypeIn order to start the TDBISAMEngine component as a database server, you must set this property to etServer.
EngineSignatureNormally this property is left at the default value. However, if you do choose to change this property, you must make sure that it is set to desired value before starting the server. The default value is "DBISAM_SIG". Please see the Customizing the Engine topic for more information.
ServerNameThis property is used to identify the database server to external clients once they have connected to the database server. The default value is "DBSRVR".
ServerDescriptionThis property is used in conjunction with the ServerName property to give more information about the database server to external clients once they have connected to the database server. The default value is "DBISAM Database Server".
ServerMainAddressThis property specifies the IP address that the database server should bind to when listening for regular incoming data connections. The default value is blank (""), which specifies that the database server should bind to all available IP addresses.
ServerMainPortThis property specifies the port that the database server should bind to when listening for regular incoming data connections. The default value is 12005.
ServerMainThreadCacheSizeThis property specifies the number of threads that the database server should actively cache for regular data connections. When a thread is terminated on the server it will be added to this thread cache until the number of threads cached reaches this property value. This allows the database server to re-use the threads from the cache instead of having to constantly create/destroy the threads as needed, which can improve the performance of the database server if there are many connections and disconnections occurring. The default value is 10.
ServerAdminAddressThis property specifies the IP address that the database server should bind to when listening for incoming administrative connections. The default value is blank (""), which specifies that the database server should bind to all available IP addresses.
ServerAdminPortThis property specifies the port that the database server should bind to when listening for incoming administrative connections. The default value is 12006.
ServerAdminThreadCacheSizeThis property specifies the number of threads that the database server should actively cache for administrative connections. The default value is 1.
ServerEncryptedOnlyThis property specifies whether all incoming regular data connections should be encrypted or not. If this property is set to True, then all incoming regular data connections to the database server that are not encrypted will be rejected with the error code 11277, which is defined as DBISAM_REMOTEENCRYPTREQ in the dbisamcn unit (Delphi) or dbisamcn header file (C++). The default value is False.

Information Administrative connections to the database server must always encrypted and will be rejected if they are not encrypted, regardless of the current value of this property.
ServerEncryptionPasswordThis property specifies the password to use for all encrypted connections. If an incoming encrypted connection does not use a password that matches this value of this property, the database server will return the error code 11308, which is defined as DBISAM_REMOTEINVREQUEST in the dbisamcn unit (Delphi) or dbisamcn header file (C++), when any call to the database server is attempted after the connection is made. The default value is "elevatesoft".

Information If you intend to use encrypted connections to a database server over a public network then you should always use a different encryption password from the default password.
ServerConfigFileNameThis property specifies the name of the configuration file that the database server will use for storing all server configuration information including users, databases, server-side procedures, user rights, and scheduled events. This file is compressed and encrypted, and a backup is made, with the extension ".scb", any time a modification is made. The default value is "dbsrvr.scf".

Information Any new configuration file name specified via this property will be given the default extension of ".scf" automatically.
ServerConfigPasswordThis property specifies the password to use to encrypt the contents of the server configuration file. This ensures that if someone does obtain physical access to the configuration file that they will still be unable to read its contents, especially user names and passwords, without this password.

Information All of the properties of the TDBISAMEngine component described above can only be modified when the Active property is False and the engine has not been started.

Starting the Server
Once you have configured the database server using the above properties, starting the server is quite simple. All you need to do is set the Active property to True. The following shows an example of how one might configure and start a database server using the default global Engine function in the dbisamtb unit (Delphi) or dbisamtb header file (C++):

with Engine do
   begin
   ServerName:='MyTestServer';
   ServerDescription:='My Test Server';
   { Only listen on this IP address }
   ServerMainAddress:='192.168.0.1';
   ServerConfigFileName:='mytest.scf';
   ServerConfigPassword:='test123456';
   Active:=True;
   end;

Information You can also use the TDBISAMEngine OnStartup event to configure the TDBISAMEngine component before it is started.

Default Login Information
The default user ID and password for the database server are:

User ID: Admin (case-insensitive)
Password: DBAdmin (case-sensitive)

This user has full administrator privileges and is widely known, so it is recommended that you delete it as a user once you have established another administrative user on the database server.

Database Servers Provided with DBISAM
DBISAM comes with an application (GUI) database server project for Delphi called dbsrvr.dpr and a command-line (console) database server project for Delphi called dbcmd.dpr. You can examine the source code of these projects to see how you would go about setting up a TDBISAMEngine component as a database server in a project. Both of these projects are also provided in compiled form with DBISAM.

Information If you wish to run either database server, either as a normal application or a Windows service, you must copy the desired database server executable into a directory with read/write permissions, based upon the user account under which you wish to run the database server, and run it from that directory. This requirement is due to the fact that the database server writes its log and configuration files to the directory where the database server executable is located. This is a legacy behavior that is not compatible with running the database server from the default installation directory in the default \Program Files (x86) sub-tree.

The dbsrvr database server can be run as a normal application or as a Windows service. When running the dbsrvr database as a normal application, the server will display an icon in the system tray that can be right-clicked to obtain general information about the server, as well as start and stop the server. You can find the dbsrvr database server in the \servers\dbsrvr sub-directory under the main installation directory for the version of DBISAM that you installed.

If you wish to run the dbsrvr database server as a Windows service you must first install it as a service by running the database server with the /install command-line switch set. For example, to install the database server as a service using a command prompt window under Windows (2000 or higher) you would specify the following command:

dbsrvr.exe /install

To uninstall the dbsrvr database server as a Windows service you must run the database server with the /uninstall command-line switch set. For example, to uninstall the dbsrvr database server as a service using a command-prompt window under Windows (2000 or higher) you would specify the following command:

dbsrvr.exe /uninstall

Information You must run the above commands while logged in as an Administrator, or they will not succeed and you will see an "Access Denied" error message. Also, the dbsrvr database server will not display an icon in the system tray, nor will it display a user interface, when run as a Windows service. Recent versions of Windows restrict services from interacting with the desktop in order to permit them to run in non-GUI server environments.

After installing the dbsrvr database server as a Windows service, you can run the database server by starting the service interactively via the Windows Services management console, or by using the net start command-line command:

net start dbsrvr

You can stop the database service interactively via the Windows Services management console, or by using the net stop command-line command:

net stop dbsrvr

The dbcmd database server can only be run as a normal (console) application. You can find the dbcmd database server in the \servers\dbcmd sub-directory under the main installation directory for the version of DBISAM that you installed.

The database servers will accept commmand-line switches that affect their behavior. The following switches are supported when starting up either database server:

SwitchDescription
/snServer name parameter
The /sn switch specifies the user-defined server name that will be used to identify the server to remote sessions. You must enclose the server name in double quotes if there are spaces in the server name. The server name is informational only.
/sdServer description parameter

The /sd switch specifies the user-defined server description that will be displayed in the caption of the server's user interface. You must enclose the server description in double quotes if there are spaces in the server description. The server description is informational only.
/saServer address parameter

The /sa switch specifies the main server IP address that the server will bind to for accepting inbound data connections. The IP address must be specified directly after the /sp switch using dot notation (i.e. 192.168.0.1). The default IP address that the server will bind to if this switch is not specified is all IP addresses available on the machine. Using this option will cause the server to only listen on the specified address. This means that it will no longer listen on the local loopback 127.0.0.1 address.
/spServer port parameter

The /sp switch specifies the main server port that the server will bind to for accepting inbound data connections. The port number must be specified directly after the /sp switch. The default main port that the server will bind to if this switch is not specified is 12005.
/stServer thread cache size parameter

The /st switch specifies the main server thread cache size. The thread cache size controls how many threads the server will cache in order to speed up connect/disconnect times. The thread cache size must be specified directly after the /st switch. The default main thread cache size that the server will use if this switch is not specified is 10.
/aaAdministration address parameter

The /aa switch specifies the administration server IP address that the server will bind to for accepting administrative connections. The IP address must be specified directly after the /aa switch using dot notation (i.e. 192.168.0.1). The default administration IP address that the server will bind to if this switch is not specified is all IP addresses available on the machine. Using this option will cause the server to only listen on the specified address. This means that it will no longer listen on the local loopback 127.0.0.1 address.
/apAdministration port parameter

The /ap switch specifies the administration server port that the server will bind to for accepting administrative connections. The port number must be specified directly after the /ap switch. The default administration port that the server will bind to if this switch is not specified is 12006.
/atAdministration thread cache size parameter

The /at switch specifies the administration server thread cache size. The thread cache size controls how many threads the server will cache in order to speed up connect/disconnect times. The thread cache size must be specified directly after the /at switch. The default administration thread cache size that the server will use if this switch is not specified is 1.
/cfConfiguration file name parameter

The /cf switch specifies the server configuration file name. The configuration file is where the server stores all configuration information including databases, users, permissions, etc. You must enclose the configuration file name in double quotes if there are spaces in the configuration file name. Do not specify a file extension for the file since the server always uses the ".scf" extension for all configuration files. The default configuration file name that the server will use if this switch is not specified is "dbsrvr".
/cpConfiguration file password parameter

The /cp switch specifies the server configuration file password. The configuration file password is used to encrypt the contents of the configuration file. You must enclose the configuration file password in double quotes if there are spaces in the configuration file password. The default configuration file password that the server will use if this switch is not specified is "elevatesoft".

Information Do not lose this password. If you do the server will not be able to read the configuration information and there is no way for Elevate Software to retrieve the configuration information.
/enEncrypted connections only parameter

The /en switch specifies that the main server will require encrypted connections only. By default the administration server always requires encypted connections, but normally encrypted connections are not required for the main server.
/epEncrypted connnection password parameter

The /ep switch specifies the password to use for encrypting all data between any remote sessions and the main and administration server. This switch can be specified without the above /en switch to change the password for encrypted connections to the administration server only. If combined with the above switch, this switch will change the password for encrypted connections to both the main server and the administration server. You must enclose the encryption password in double quotes if there are spaces in the encryption password. The default encryption password that the server will use if this switch is not specified is "elevatesoft".

Information If this password is not set to the same value that is used by the remote sessions connecting to either the main or administration server, the remote sessions will receive errors and not be able to connect to the server at all.
/alAppend to log parameter

The /al switch specifies that the server should append to any existing server log file when the server process is started. The default behavior is to overwrite the log every time the server process is started.

The only difference between starting the dbsrvr database server as a normal application and starting the dbsrvr database server as a Windows service is in the way the switches are specified. When the dbsrvr database server is started as a normal application, you may specify the switches directly on the command-line that you are using to start the database server. For example the following command will start the dbsrvr database server using port 13000 for the main port and 13001 for the administration port:

dbsrvr.exe /sp13000 /ap13001

When the dbsrvr database server is started as a Windows service, you may specify the switches via the Startup Parameters in the properties for the service in the Services management console, or directly on the command-line that you are using to start the dbsrvr database server with the net start command. For example the following command will start the database server as a service with it using port 13000 for the main port and 13001 for the administration port:

net start dbsrvr /sp13000 /ap13001

Information In order to start the dbsrvr database server as a Windows service the database server must have already been installed as a service using the /install command-line switch.

In addition to using command-line parameters, you may also use an .ini file to specify the parameters for the database server. The following is a sample .ini file that can be used with either the dbsrvr or dbcmd database servers:

; Sample DBISAM Database Server Parameters INI File

[Server Parameters]
; Default server name is the EXE name
Server Name=Test Server
; Default server description is DBISAM Database Server
; plus the Server Name
Server Description=Test Server Description
; Default server IP address is all addresses on the machine
Server Address=127.0.0.1
; Default server port is 12005
Server Port=10001
; Default server thread cache size is 10
Server Thread Cache Size=20
; Default admin IP address is all addresses on the machine
Administration Address=127.0.0.1
; Default admin port is 12006
Administration Port=10002
; Default admin thread cache size is 1
Administration Thread Cache Size=4
; Default configuration file name is dbsrvr
Configuration File=Test
; Default configuration file password is elevatesoft
Configuration Password=cannotguessme
; 0=main server allows unencrypted connections (default)
; 1=main server allows only encrypted
Encrypted Only=0
; Default encryption password is elevatesoft
Encryption Password=cannotguessme
; 0=overwrite log file (default) 1=append to log file
Append To Log=0

; SQL performance logging

; 0=no SQL performance logging (default) 1=log all statements with execution times above the min execution time (below)
SQL Performance Tracking=0
; Minimum execution time, in seconds, required before an SQL statement is logged (default is 30 seconds)
Min SQL Performance Execution Time=30
; SQL performance log file name
SQL Performance File Name=
; Max SQL performance log file size (default is 128MB)
Max SQL Performance File Size=134217728
; 0=no auto-incrementing of SQL performance log file name 1=auto-increment SQL performance log file name
Auto-Increment SQL Performance File Name=0
; Max SQL performance log file autoinc (default is 64)
Max Auto-Increment SQL Performance File Name=64

Information The .ini file that contains the database server parameters must have the same root file name as the database server itself. For example, if you wanted to use the above .ini file with the dbsrvr database server, you would need to save it to a dbsrvr.ini file in the same directory as the dbsrvr.exe executable in order for the database server to find it and use its contents. Likewise, if you wanted to use it with the dbcmd database server, you would need to save it to a dbcmd.ini file in the same directory as the dbcmd.exe executable.

Multiple instances of the database server can be started on the same physical machine. The root name of the database server executable is used to determine the name of the log and parameters (.ini) files to use when the database server is started. Also, when running as a Windows service the dbsrvr database server relies on the root name of the database server executable to determine the service name. What this means is that to have multiple instances of the database server running on the same machine you must put them in separate physical directories if running them as a normal application, or copy the database server to different executable files with a different root name if running them as a service. For example, if you wanted to run two instances of the database server as services, you would copy the dbsrvr.exe to two separate executable files called dbsrvr1.exe and dbsrvr2.exe. Then you would install and run them as follows:

First database server

dbsrvr1.exe /install

net start dbsrvr1

Second database server

dbsrvr2.exe /install

net start dbsrvr2
Image