ADABAS D on Linux - HowTo

Introduction

ADABAS D: the complete implementation of the relational database model

ADABAS D is a high-performance database, which efficiently and easily utilizes system resources and is portable across several UNIX, Linux, Windows 95 and NT platforms. By combining ease of administration with high performance, ADABAS D is an ideal database system for workgroup and business-critical applications in client-server environments.

Although ADABAS D is capable to handle gigabytes of data, Software AG provides free versions (Personal Edition) on Windows 95/NT and Linux, limited to a data volume of 24 MegaByte and 3 concurrent user sessions. This Personal Edition will be called PE in this HowTo document for short.

There are two unlimited versions of ADABAS D available for Linux called ADABAS D Workgroup Edition (Entry) for 10 concurrent user sessions and ADABAS D Workgroup Edition (Business) for an unlimited number of users.
This Linux Workgroup Edition will be abbreviated as LE in this document.

This HowTo tells you everything you should know to install either the Personal Edition (PE) or Workgroup Edition (LE) on a Linux System.

If you find something important missing or if you know some hints making life easier with Adabas D on Linux, send an email to the author (address see below), who will probably insert your notes into this paper.

Here is an overview of the following sections.

The first chapter Requirements describes the minimal equipment of your computer and the environment you should create on your system before installing Adabas D.

Then chapter Installation will describe the installation process and tries to give you some clues, what to do in the unlikely case it fails.

After this, chapter Using the RDBMS tries to give some hints, what to do with the ready-installed database server, e.g. administration of the server, building an application, using the tools...

Finally, chapter Trouble shooting gives some hints what to do, if anything doesn't work the way it should.

Requirements

The requirements to install Adabas D successfully are:

CD-ROM

First of all you need a CD-ROM player. Your Linux kernel must have the iso9660 file system built into or available as a loadable module. If you have an empty directory (/cdrom, /mnt, or the like) and the device for your CD-ROM is e.g. /dev/scd0 (for a SCSI player), then after inserting the Adabas D CD-ROM there should be no problem to mount it with
mount -t iso9660 /dev/scd0 /cdrom
Perhaps you must be root to do this.

You can do the mount as an ordinary user if there is a line in /etc/fstab for your CD-ROM device with the user option. Note that turning on the user option automatically sets noexec. So be sure to explicitly add the exec option for your CR-ROM device or use the -o exec option as command line argument, to allow execution of programs from this file system.

Database user

There has to be a user and a group to whom all the installed executables and data devices belong. This account cannot be the root account, since the database kernel refuses to start if run with userid 0.

For a single user desktop system it is sufficient to use the normal user account and group you always login in. Nevertheless it is recommended that you create a user adabas and a group database (these names aren't fixed, but used everywhere throughout this HowTo). Since you must be able to login using this account, you should give it a login shell and DBROOT (see below) as home directory.

Later on during installation you have to enter the name of the user and group into the installation program, which will set the ownership of all installed files to this user. (You could as well change the user and group owner later using chown, but that's is not the preferred method)

DBROOT

You must have a certain amount of free space on your hard disk before installing Adabas D. The minimum disk usage if about 60 MB, as the CD cover says; if you want to install the preconfigured database with its data size of 24 MB, (and this is what we recommend), your destination directory must be on a partition with at least 70 MB of free disk space.

This directory will become the root directory of your Adabas D database; we will call it DBROOT from now on. For examples in this HowTo we will use /usr/local/adabas as DBROOT.

To use the database, you must have set the environment variable DBROOT pointing to this directory. You can add the following line to the file /etc/profile:
DBROOT=/usr/local/adabas; export DBROOT
Then for all users this variable is set automatically. If you don't want to fiddle with /etc files, you can add this line to the file .profile in the homedirectory of every user using Adabas D respectively.

PATH

While we are talking about environment variables, there is one more to modify: PATH. All the executable files are stored in the subdirectory bin of DBROOT, so we recommend to add the following line to /etc/profile or .profile (see above):
PATH=$PATH:$DBROOT/bin
It is much better to put the new directory to the end of the list, since this way the X11 program /usr/X/bin/xload will be called instead of the database import/export tool $DBROOT/bin/xload and so it won't break existing startup files. The database tool can still be called with its second name xdbload.

Shared memory

For a Linux system the upper limit of shared data is built into the kernel and can't be adjusted within a running system or by means of the configuration dialog. It is defined as a constant SHMMAX in the kernel sources. The default value of SHMMAX and the path of the include file containing its definition depends on the Linux kernel version.

For a Linux System prior to 2.0 it is defined in /usr/src/linux/include/linux/shm.h and its value is 0x400000. Since Adabas needs a litte more even for a system with only five users and normal-sized caches, you have to increase this limit.

For newer Linux Systems (2.0 or later) it is defined in /usr/src/linux/include/asm/shmparam.h and its value is 0x1000000. A properly configured database for five users will hardly need more than 16MB, so you can live with this default. But be aware of the fact that you still have to adjust some parameters during the installation of an own new database, since the default values require more than 16MB (see section Creating your own database).

If you have to increase the constant, edit the include file and look for a row that starts with #define SHMMAX. Replace the number by e.g. 0x1000000.

Creating a new Linux kernel depends on the distribution you use. If you are booting with LILO, a call of make zlilo is all you need. Otherwise a call of make zImage will create a compressed kernel and you have to install it manually after this.

Installation

If your Linux box fulfills all the requirements mentioned above, the CD-ROM is mounted, DBROOT and PATH are set, and you know the name and password of the database user and the password of the root account, you can start to install right now.

For installation you should be logged in as the database user (in our examples adabas). If you are logged in as a different user, you should become the database user by means of the su command. If you are sitting in front of an X display, you have to allow other accounts to connect to your X server by typing the following command before issuing the su:
xhost +myHostName

The installation with a graphical interface can be started by
/cdrom/install&
First you should select the packages to install; the default choice (the database software itself and the preconfigured example database MYDB) is a good point to start with. Then click through the five points in order.

Note that there is a small inconvenience in the file selection dialogs, you will get into in the first two points. They allow only a selection of files (and not directories), so that you can't push the Okay button if your DBROOT directory is still empty (and probably it is!). You can avoid this by calling install with two parameters (source dir and DBROOT) like this:
/cdrom/install /cdrom $DBROOT&

If for any reason no X display is available, you have to issue the following commands instead:
/cdrom/install.lnx
x_install

Creating your own database

Note that if you have installed the preconfigured database MYDB, you can skip this section.

If you don't want to install the preconfigured database MYDB or if you want to create another database, you can do this with the DBA tool xcontrol.

There are three parameters you must adjust, since the default values are of little value for the average Linux box.

Using the RDBMS

State of a database server

At every point in time the database server is in one of the following three states:
offline
The database kernel is not running at all; no resources are occupied. An application trying to connect will answer database not running
cold
The database kernel is running, but will not respond to the normal SQL commands; only some maintenance commands are allowed (notably RESTART). An application trying to open a normal user connection will get the error -8000 (database must be restarted).
warm
The database kernel is running, and will respond to the normal SQL commands.
The following lines show the Bourne and Tcl shell scripts, you can use to start/stop your database, if your database is called MYDB, DBROOT points to /usr/local/adabas and the control user/password combination is control,control.

start.sh:

    #!/bin/sh
    x_start MYDB
    xutil -d MYDB -u control,control restart
stop.sh:
    #!/bin/sh
    xutil -d MYDB -u control,control shutdown
    x_stop MYDB
start.tcl:
    #!/usr/local/adabas/bin/adabastclsh
    exec x_start MYDB
    set l [adalogon control,control -serverdb MYDB -service utility]
    adautil   $l restart
    adalogoff $l
stop.tcl:
    #!/usr/local/adabas/bin/adabastclsh
    set l [adalogon control,control -serverdb MYDB -service utility]
    adautil   $l shutdown
    adalogoff $l
    exec x_stop MYDB
Although the tcl solutions are a more keystrokes to type, I prefer them, since there are less unix processes used. Also you can ask the current state of the database with the tcl command adautil $l state and react accordingly to the answer.

The following is an init script for use with the S.u.S.E boot concept (starting with version 4.4.3). You can put the following lines into a file /sbin/init.d/adabas and make soft links to e.g. /sbin/init.d/rc3.d/S25adabas and /sbin/init.d/rc3.d/K15adabas. Then the database kernel will get automatically started and stopped when you switch into or out of runlevel 3.

#! /bin/sh

. /etc/rc.config

[ -z "$DBROOT" -o -z "$DBUSER" -o  -z "$DBNAME" -o -z "$DBCONTROL" ] && exit

export DBROOT DBUSER DBNAME DBCONTROL

case "$1" in
    start)
        echo "Starting Adabas D."
        su $DBUSER -c $DBROOT/bin/adabastclsh << 'EndOfScript'

# ------------- BEGIN StartScript BEGIN -----------------
if [catch {exec $env(DBROOT)/bin/x_start $env(DBNAME)} msg] {
    puts $msg
    exit
}
if [catch {adalogon $env(DBCONTROL)  -serverdb $env(DBNAME) -service utility} l] {
    puts $l
    exit
}
if [catch {adautil $l restart} msg] {
    puts $msg
    exit
}
adalogoff $l
# --------------  END  StartScript  END  ----------------

EndOfScript
;;
    stop)
        echo -n "Shutting down Adabas D:"
        su $DBUSER -c $DBROOT/bin/adabastclsh << 'EndOfScript'
    
# -------------- BEGIN StopScript  BEGIN ----------------
if [catch {adalogon $env(DBCONTROL)  -serverdb $env(DBNAME) -service utility} l] {
    puts "\n$l"
    exit
}
catch {adautil $l shutdown}
adalogoff $l

if [catch {exec $env(DBROOT)/bin/x_stop $env(DBNAME)} msg] {
    puts "\n$msg"
    exit
}
puts " stopped."
# --------------  END  StopScript   END  ----------------

EndOfScript
;;

      *)
            echo "Usage: $0 {start|stop}"
            exit 1
esac
You also have to put something like the following at the end of /etc/rc.config:
#
# Adabas D on Linux (Software AG)
#
# If you want to start Adabas D, the relational database system,
# automatically on system reboot, give values to DBROOT, DBNAME
# DBUSER and DBCONTROL.
#
# DBROOT: The top directory of the Adabas D installation.
#
DBROOT=/usr/local/adabas
#
# DBNAME: The name of the database you want to start at
#         system boottime.
#
DBNAME=MYDB
#
# DBUSER: The name of the unix account, to whom all the
#         Adabas files belong.
#
DBUSER=adabas
#
# DBCONTROL: The connect string of the adabas control user in the
#            form <name>,<password> or ,<userkey>.
#            Example for MYDB: control,control
#
DBCONTROL=control,control
#

The User file

There are at least three users existing in every single database: The unix user accounts are not related to the database users. But you can build a file available only to your unix account containing short keys for all the database users you normally use. This file is called .XUSER, resides in your home directory, and can be edited by xuser or tkuser.

My user file contains the following entries:
Userkey DEFAULT for krischan,geheim
Userkey c for control,control
Userkey demo for demo,demo
Userkey sys for superdba,admin

Having this file I can call the tools with the -U option as shown in the following examples. Note, that the last two examples are actually the same thing.

    panel   -Uc
    xquery  -Usys
    fotos   -Udemo
    tkquery -UDEFAULT
    tkquery

Embedded SQL in C (for Web Applications, too)

Every program, that connects to the Adabas database server, needs the environment variable DBROOT set. A compiled C program with embedded SQL will terminate with the following message on standard error when executing the CONNECT statement, if DBROOT is not set:
sqlinit: DBROOT must be set !!!
When a cgi script is called by Apache (or any another Web server), there are only a few environment variables available. Notably DBROOT isn't in the set of variables, specified by the http protocol. You can configure Apache in its http.conf file to set an additional variable by means of the SetEnv directive.
SetEnv DBROOT /usr/local/adabas

ODBC

More to come...

Tcl

There is a german Crash course into Tcl/Tk and AdabasTcl available on the net.

Trouble shooting

The program install doesn't execute

Be sure to mount the CD-ROM with execution of programs from this device enabled (by explicitly mentioning the -o exec option or by adding the exec option to the line in /etc/fstab. See also section CD-ROM.

The graphical install program hangs while extracting the archives

After starting step 3 of the installation (extraction of the software archives), a window with the progress display pops up, but its value stays at 0% all the time.

The problem occurs with the first edition of the PE, if your tar program gives the date of a file in the form yyyy-mm-dd and not separated by blanks. This seems to be the case in newer Caldera systems. There is no workaround; you have to use install.lnx and x_install (see chapter Installation).

Cannot read param file...

The configuration parameters are stored in a directory tree, starting at /usr/spool/sql. This directory seems to be missing. Maybe you moved your database from one computer to another be simply copying $DBROOT, maybe you removed the directory by means of the rm command. The directory /usr/spool seems to be missing on Red Hat Systems all together.

In every case step 4 of the installation process (call of the postinstallation script x_install) wasn't finished properly. This is a hard to notice when working with the graphical setup, since the xterm closes immediately after termination of the installation script, so that an error message is visible only a very short time.

To fix this problem, first make sure, that there exists a /usr/spool directory. Since the normal path of the spool directory is /var/spool on most Linus systems, you can create a soft link at /usr/spool pointing to /var/spool. Finally call $DBROOT/bin/x_install as superuser.

Cannot create rundirectory 0

Dependend on the tool you use, you can get one of the following error messages, and all are of the same origin (yes, the last one, too!): It is a problem of unix user permissions. The configuration parameters are stored in /usr/spool/sql/config; this file must be readable by the program reporting this error (probably xcontrol, panel or x_start).

The program which investigates one configuration parameter ($DBROOT/pgm/getparam) simply returns 0, if it can't find or read this file. But you can't create a directory 0...

The bottom line is that you should call the administration tools only as the user who was mentioned to x_install during installation (see also section Database user).

You can call tools non administration tools like tkquery or xquery as every user, just be sure to set DBROOT and to modify PATH by adding :$DBROOT/bin.

If there appears a warning like the following (even if the mentioned directory exists and gives permissions to read/write):
sql22_msg: cannot create directory 'dbroot/wrk/unix-account': ERRNO 13
you can ignore it or change the permissions of both dbroot/wrk and dbroot/wrk/unix-account.

sqlinit: cannot find user name for uid xxx!

If all the programs of Adabas D report this error, there is an error in your /etc/passwd (most probably a missing colon). Note that the invalid line doesn't have to be the database user or the current login; any error in any line will get Adabas to complain.

If your account is registered in the yellow pages of the NIS service, you will get the same error. Currently there seems to be no tested workaround other than to insert your account into the local /etc/passwd.

Perhaps it may work to add lines like the following into /etc/nsswitch.conf to avoid the second problem. Since I have no NIS on my local network, I can't test it. But I'm looking forward a mail of someone, who can.

passwd: files nisplus nis
shadow: files nisplus nis
group:  files nisplus nis

Cannot open /dev/syscon

This isn't really an error. Whenever you create a new database, the default value for the kernel parameter OPMSG1 is set to /dev/syscon. If the file can't be opened, the messages wouldn't be printed. Since they go into the kernel diag file anyway, this isn't that bad (see also section Creating your own database).

To avoid this message, enter /dev/null as OPMSG1, in the Install Serverdb or Configuration/Alter Parameters/Kernel dialog.

The kernel dies while starting.

Please look at the kernel diagnose file (in Panel with F2, or with a normal text editor at e.g. /usr/local/adabas/wrk/MYDB/knldiag). There should be a message about the reason of the abort a few lines above the end of the file.

Under some circumstances no correct kernel diagnose file would be written; this seems to be the case only, if you create a new database with xcontrol (the recommended way). In this case you have to leave xcontrol and start the database kernel manually from the shell prompt by entering x_start .

There are three critical sections, where the start up of the database kernel may be aborted. Here we will describe them in the order, they appear.

Clients connect only to hosts listed in /etc/hosts

Although your network is configured to use a nameserver, so that your /etc/hosts file is rather emtpy, all Adabas clients of your LE refuse to connect to hosts not listed in this file.

The reason for this behaviour is a missing file /etc/nsswitch.conf, where you can configure the used nameservices. This file must contain at least the follwoing line, so that the Adabas D runtime system uses name services.

hosts:  files nisplus nis dns

unknown service 'sql30' (see /etc/services)

One limitation of the PE is that you can't access databases on remote hosts. You need some additional software for this, i.e. a server listening to port sql30. So there is no use in adding a line to /etc/services.

To avoid this error, be sure to give no -n option, don't put a hostname into the -d option and leave the server node entry in the user file empty.

If you really need to connect to a server on a different host, you have to upgrade to the LE.

-20035 Remote SQL Server could not be started

When you enter xcontrol with the Remote SQL Server already running, xcontrol displays Remote SQL as DISABLED. If you are trying to start the server again with the menu entry Options.../RemoteSQL Server.../Start, you get the error message, that it couldn't be started.

Since xcontrol uses the ps command with system V style parameters, it cannot correctly determine, if the Remote SQL server is running. To prevent this error, set the environment variable PS_PERSONALITY to POSIX before starting xcontrol. This can be done on the command line of a bourne shell like the following.

PS_PERSONALITY=POSIX xcontrol -d MYDB -u demo,demo

The GUI tools terminate with an error

There are (at least) three reasons for these programs to fail.

Error -8000 while loading system tables

This error seems to occur only on newly installed Caldera Systems. When you create a new database with xcontrol, this error may occur during the loading of the system tables. Simply enter xcontrol again, select Operation../Restart../Warm and finally start Configuration../Load System Tables.

Bug reports

Comments, suggestions, etc. concerning this HowTo should be mailed to
krischan@cs.tu-berlin.de

Everything concerning Adabas D on Linux itself should be posted to comp.databases.adabas if of general enough nature. Note that both (PE and LE) are not directly supported by Software AG. Should you encounter serious problems, please see http://www.sag.de/linux1.htm to order support and upgrade service at the Linux reseller of your choice.

Have fun, Krischan

Christian Krone
krischan@cs.tu-berlin.de