mSQL 1.x offered several configuration options, including such details as the user the server should run as, the location of the TCP and UNIX sockets for client/server communications, the location of the database files etc. The problem with configuring mSQL 1.x was that all these details were hard-coded into the software at compile time. Once the software was compiled and installed you couldn't easily change those settings.
To overcome this problem, mSQL 2.0 utilises an external run-time configuration file for definition of all these values. The file is called msql.conf and is located in the installation directory (usually /usr/local/Hughes). An application can choose to use a different configuration file by calling the new msqlLoadConfigFile( ) API function. All standard mSQL applications and utilities provide a command line flag, -f ConfFile , that allows you to specify a non-standard configuration file. When an application first calls the mSQL API library, a check is made to see if a configuration file has been loaded via a call to the msqlLoadConfigFile( ) function. If no such call has been made, the API library loads the default config file. Any values that are specified in that file will over-ride the normal operating paramaters used by mSQL.
The configuration file is a plain text file organised into sections. The file can contain blank lines and comments. A comment is a line that begins with the '#' character. Each section of the configuration file has a section header, which is written as the section name enclosed in square brackets (for example [ general ]). Currently the only section defined is the general section although further sections covering security and access control will be added later.
Configuration values within a section are presented using the config parameter name followed by and equals sign and then the new value. There can only be one entry per line and if an entry is defined multiple times in the one config file the last value defined will be used. If a parameter is not defined in the config file then an internal default value will be used at run-time.
The following configuration parameters are available in the general section of the config file. Please note that %I may be used in configuration entries to signify the mSQL installation directory (e.g. /usr/local/Hughes).
Parameter Default Value Definition Inst_Dir /usr/local/Hughes The full path to the installation directory. This is the directory in which all the mSQL files are located (such as the program files, the database files etc). mSQL_User msql The user that the mSQL server should run as. If the server is started by a user other than this user (e.g. it is started as root from a boot script) it will change UID so that it runs as the specified user. Admin_User root The user that is allowed to perform privileged operations such as server shutdown, cration of databases etc. Pid_File %I/msql2.pid The full path of a file in which the PID of the running mSQL server process will be stored. TCP_Port 1114 The TCP port number on which the mSQL server will accept client/server connections over a TCP/IP network. If this value is modified it must be modified on the machine running the client software also. UNIX_Port %I/msql2.sock The full path name of the UNIX domain socket created by the mSQL server for connections from client applications running on the same machine.
Below is a sample configuration file. This file does not achieve anything as it just sets the parameters to their default values.
# # msql.conf - Configuration file for Mini SQL Version 2 # #-------------------------------------------------------------- # # This file is an example configuration and may require # modification to suit your needs or your site. The values # given are the default values and will be used by the # software if either this file is missing or a specific value # is not specified. # #-------------------------------------------------------------- [general] Inst_Dir = /usr/local/Hughes mSQL_User = msql Admin_User = root Pid_File = %I/msql2.pid TCP_Port = 1114 UNIX_Port = %I/msql2.sock