Monday, August 9, 2010

Installing and Configuring Informix Connect on the Client

It is likely that some of the clients connecting to your Informix engine will run on a different server than the engine.  Enabling a remote server for Informix connections is a simple three step process of setting up some environment variables, installing the free Informix Connect product and creating a sqlhosts file.


We need to create an INFORMIXDIR to hold our Connect install.  This is very similar to what we did with the engine install, except I like to name the INFORMIXDIR /opt/informix-connect to instead of just /opt/informix.

root> mkdir /opt/informix-connect-3.50.FC7
root> chown informix:informix /opt/informix-connect-3.50.FC7
root> ln -s /opt/informix-connect-3.50.FC7 /opt/informix-connect
root> ls -ltr /opt
total 4
drwxr-xr-x  2 informix informix 4096 Aug  1 20:56 informix-connect-3.50.FC7
lrwxrwxrwx  1 root     root       30 Aug  1 20:56 informix-connect -> /opt/informix-connect-3.50.FC7

Setup Environment Variables

As with the engine install we create a script to automatically set the necessary environment variables.

root> vi /etc/profile.d/

# informix client environment variables

# location of informix installation
export INFORMIXDIR=/opt/informix-connect

# sqlhosts file definition

# default dbserver name
export INFORMIXSERVER=blogsvr01

# location of informix libraries
Notice that some environment variables are not needed on the client but a new one is. LD_LIBRARY_PATH tells a client where to find any Informix libraries it needs.

Install Informix Connect

Download Informix Connect from IBM, the file will be called connect.3.50.FC7.LINUX.tar or something similar. As root (with the environment variables from set) untar and run installconn to install.  Accept the License Agreement (if you want to) and use the defaults supplied in the install script, being sure to install in /opt/informix-connect.

root> . /etc/profile.d/
root> tar -xvf connect.3.50.FC7.LINUX.tar
root> ./installconn
Welcome to the InstallShield Wizard for IBM Informix IConnect Version 3.50

The InstallShield Wizard will install IBM Informix IConnect Version 3.50 on
your computer. 
The InstallShield Wizard has successfully installed IBM Informix IConnect
Version 3.50. Choose Finish to exit the wizard.

Press 3 to Finish or 4 to Redisplay [3]

Add the idstcp01 Port and Create the sqlhosts File

Modify the /etc/services file to add the TCP/IP port that our server is listening on.

root> vi /etc/services

idstcp01    1526/tcp      # Informix
The client needs to know how to connect to your server and the sqlhosts file is where put the information it needs.  This will be very similar to the sqlhosts file we created for the engine.


# blogsvr01
blogsvr01   onsoctcp    blogsvr01    idstcp01
And that should just about do it. It's all over but the testing. I like to use Python myself (you'll need Python and the informixdb module installed for the following to work) since dbaccess only comes with the engine (why?)

informix> python
Python 2.4.3 (#1, Sep 17 2008, 16:07:08)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-41)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import informixdb
>>> dbCon = informixdb.connect("blog@blogsvr01", "informix", "n0tT311ing")
>>> dbCon
<_informixdb.Connection object at 0x2b740f5fd580>

No comments:

Post a Comment