Previous Next Contents

4. Running Informix

4.1 Starting the database engine

Using sqlexec

To start Informix-SE, make sure you have at least the environment variables $INFORMIXDIR and $INFORMIXSERVER set and that you have $INFORMIXDIR/bin appended to your path. Then, simply typing

<frodo> $ dbaccess

will start a sqlexec session. Pressing enter will present a list of databases which you can open; use the arrow keys to select your desired database and press Enter.

Using sqlexecd

Unless you are allowing remote access to a database host (the machine on which the database lives), don't use sqlexecd. If you insist, however, read on.

Because sqlexecd runs as a daemon, it must be started by root. There are a variety of ways to accomplish this. Regardless of how you decide to do so, $INFORMIXDIR must be set and a valid database server name (as defined in $INFORMIXDIR/etc/sqlhosts) must be specified as an argument to sqlexecd. See How do I allow remote connections? for more details.

To start sqlexecd at boot time, add the following to rc.local (wherever it is located on your system). If you prefer SysV init-style scripts, of course, you may use that approach. If the previous sentence is gibberish to you, use the rc.local approach.

export INFORMIXDIR=/path/to/informix/installation
$INFORMIXDIR/lib/sqlexecd dbserver_name

To start sqlexecd at any other time, execute the same command as above. For convenience, it is common to set $INFORMIXDIR and $INFORMIXSERVER in /etc/profile. Many sites, particularly large installations, use one or more global initialization scripts to set these and other Informix-related environment variables.

4.2 Stopping

When using dbaccess, there is no need to kill sqlexec directly, because exiting dbaccess will (under normal circumstances), kill the related sqlexec process automatically. Under abnormal circumstances, however, I strongly recommend killing sqlexec's parent process, such as dbaccess or the shell or compiled ESQL/C program rather than sqlexec itself, since otherwise you may corrupt your database. Killing the parent process will send a signal to sqlexec and give it an opportunity to shut down normally.

This is important enough that I am going to repeat myself: Never kill a sqlexec process unless all other solutions have failed miserably. Doing so, particularly in a database using transaction logs, carries the risk and likelihood of trashing your database. When transaction logging is in effect, killing sqlexec potentially results in an incomplete transaction that doesn't get rolled back: with sqlexec gone, any locks in place are cleared, so other processes will continue to manipulate the partially-updated data. You really don't want to do this! Never kill a sqlexec process unless you have absolutely no other alternative.

On the other hand, it is fairly harmless to kill sqlexecd. Its only purpose is to listen on a port for incoming connections requests, fork off a sqlexec process to service those requests, then go back to listening for another request.

4.3 What are these error codes?

To convert Informix-SE error codes into human-readable form, use the finderr program (again, making sure that $INFORMIXDIR/bin is in your path):

finderr <-num> returns the error text for error -num
finderr <num> returns the error text for error -num
finderr <+num> returns the error text for err num

You can also look up the error number in the Informix Error Messages guide available at Informix's Answers OnLine site (see Informix Documentation).


Previous Next Contents