Wydawca (split by node):   Section:   Chapter:FastBack: configuring   Up: configuring   FastForward: wydawca.conf   Contents: Table of ContentsIndex: Concept Index

4.8 SQL Databases

Several statements in configuration file may need to access an SQL database. Wydawca is able to use any number of databases simultaneously, the only restriction being that they must be MySQL databases (this restriction will be removed in future releases).

A database is defined using sql block statement:

Config: sql id { ... }
sql id {
  config-file file;
  config-group group;
  host hostname;
  database dbname;
  user username;
  password string;
  ssl-ca string;
}

Here, id is a string uniquely identifying this database. It is used by other configuration statements (e.g. by dictionaries, see the next section) to refer to this database.

Config: sql: config-file name

Set the name of the SQL configuration file to read.

Config: sql: config-group name

Set the name of the group in the SQL configuration file, from where to read configuration options.

The statements above allow to keep all security-sensitive information, such as SQL username and password, in an external configuration file and thus to relax permission requirements for wydawca.conf. The exact format of such external configuration file depends on the flavor of SQL DBMS in use. As of version 4.0.3 wydawca supports only ‘MySQL’, so the configuration file is what is called option file in ‘MySQL’ parlance (see option files).

For example, suppose your wydawca.conf contains the following:

sql default {
  config-file /etc/wydawca.mysql;
  config-group wydawca;
}

Then, the /etc/wydawca.mysql would contain the actual parameters for accessing the database, e.g.:

[wydawca]
socket = /var/db/mysql.sock
database = savane
user = savane
pass = guessme

Another way to specify database credentials is by using the statements described below. If you prefer this way, you will have to tighten the permissions of wydawca.conf so that no third person could see the SQL password. The recommended permissions are ‘0600’.

Config: sql: host hostname[:port-or-socket]

Set the hostname or IP address of the host running the database. Optional port-or-socket specifies port number (for TCP connections) or socket name (for UNIX sockets) to use. In the latter case, the hostname and the colon may be omitted. If, however, it is present, it must be ‘localhost’.

Config: sql: database name

Specifies the database name.

Config: sql: user name

Sets the database user name.

Config: sql: password string

Sets the password for accessing the database.

Config: sql: ssl-ca file

Sets the pathname to the certificate authority file, if you wish to use a secure connection to the server via SSL.

An example sql statement follows:

sql default {
  host db.example.org:3306;
  database savane;
  user root;
  password guessme;
}

It is possible to combine both methods, e.g.:

sql default {
  config-file /etc/wydawca.sql;
  host db.example.org:3306;
  database savane;
}

Then, wydawca will attempt to obtain the missing information (username and password, in this case) from the /etc/wydawca.sql file.

Wydawca (split by node):   Section:   Chapter:FastBack: configuring   Up: configuring   FastForward: wydawca.conf   Contents: Table of ContentsIndex: Concept Index