Skip to content

Ingres

Ingres is one of the pioneer databases for mysql, oracle and postgres. It is not present in the linux distributions (at least not debian) and has to be installed manually.

Installation

From source

The source is downloadable at http://esd.actian.com/product/Community_Projects/Ingres_Database/Linux_X86_64-bit/Ingres_10.1_Build_125/ingres-10.1.0-125-gpl-src.tgz/http But i bailed out rather quickly with a LOT of problems to which no single clue could be found on internet forums. So it's the easy way i chose, and that's in the next chapter.

Binary

You will need to register with actian first : http://www.actian.com. And download the appropriate file. For me it was the "Community Edition" (free), ingres-10.1.0-125-gpl-linux-ingbuild-x86_64.tgz. This file was a NON-RPM, 64 bits version. And this really installed out of the box.

It really boils down to :

changetitle
1
2
3
tar -zxvf ingres-10.1.0-125-gpl-linux-ingbuild-x86_64.tgz
cd ingres-10.1.0-125-gpl-linux-ingbuild-x86_64
sudo ./install.sh

And answer a LOT of questions. You will be left with an installation in /opt/Ingres/IngresII if you stick with the defaults. And nothing will run. You will have to run the environment script to get correct paths for the executables.

changetitle
1
2
3
4
ingres demodb
bash: ingres: command not found
. /opt/Ingres/IngresII/ingres/.ingIIsh
ingres demodb

And :

changetitle
1
2
3
4
5
6
7
8
INGRES TERMINAL MONITOR Copyright 2011 Actian Corporation
Ingres Linux Version II 10.1.0 (a64.lnx/125)GPL login
Wed Oct  9 17:02:56 2013
Enter g to execute commands, "help helpg" for help, q to quit

continue
* 
q

The installation script should have started ingres, but you can do it yourself with.

changetitle
1
2
3
ingstart
ingstatus
ingstop

etc.

Usage

Actually it started flowing back a little after playing around with ingres. The commands are executed with ''. And i even remembered you can edit the buffer with ''.

For the remainder, here are just some commands to use :

show tables

A very elaborate query is needed to filter the system tables out :

changetitle
1
2
3
select table_name
from iitables 
where table_type = 'T' and system_use = 'U' and table_name not like 'ii%'

But it is much easier to use the help command :

changetitle
help g

This will print the tables of the database. And these commands all do what you'd expect them to do :

changetitle
select * from country g
select * from airline g

pitfall This last command reports the last column as 'al_cco' but that is abbreviated. It's really called al_ccode. So a command like below will fail.

changetitle
1
2
3
4
5
select al_cco from airline g
Executing . . .

E_US0836 line 1, Column 'al_cco' not found in any specified table.
    (Wed Oct  9 17:10:39 2013)

It needs to be :

changetitle
select al_ccode from airline g

Joins are straightforward:

changetitle
select * from airline left outer join country on al_ccode = ct_code g

php calling

Note ! You will also need to invoke the ingres script to use this !! There is a php module for ingres, but you will need pecl get it.

changetitle
pecl install ingres
pecl list

You also need to enable the ingres module, the pecl step will warn you for this. To have it working in apache and also the commandline, edit these files :

changetitle
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini

And in both add this line, in the "Dynamic Extensions" section:

changetitle
extension=ingres.so

After this you can run this simple script to connect to ingres.

changetitle
<?php
$link = ingres_connect("demodb", "kees", "")
    or die("Could not connect");
echo "Connected successfully";

$result = ingres_query($link, "select * from country");
while ($row = ingres_fetch_row($result)) {
    echo $row[1];
    echo $row[2];
    echo "\n";
}
ingres_close($link);
?>