Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    3

    Unanswered: Informix error - INFORMIXSERVER value not listed in sqlhosts

    Hi

    Trying to setup an informix connection to our existing informix 9 server using apache/php. Any help would be greatly appreciated. Error message is:

    Warning: ifx_pconnect(): E [SQLSTATE=IX 000 SQLCODE=-25596] in /www/ifx.php on line 13
    Unable to connect to Informix database

    Informix error: E [SQLSTATE=IX 000 SQLCODE=-25596]

    The INFORMIXSERVER value is not listed in the sqlhosts file or the Registry.

    ************************************************** ****
    <?php

    $database = "authtest";
    $server = "sun450";
    $login = "informix";
    $password = "password";

    $dbs = $database . "@" . $server;

    $connect_id = ifx_pconnect($dbs,$login,$password);

    if (!$connect_id) {
    echo "Unable to connect to Informix database<br>\n";
    chk_ifx_err1($connect_id);
    } else {
    echo "Informix connection successful! <BR>";
    }

    ************************************************** *****
    /opt/informix/etc/sqlhosts
    authlive ontlitcp sun450 sqlexec1
    authlive_shm onipcshm sun450 authlive

    authtest ontlitcp sun450 sqlexec2
    authtest_shm onipcshm sun450 authtest

    authconv ontlitcp sun450 sqlexec3
    authconv_shm onipcshm sun450 authconv

    authdemo ontlitcp sun450 sqlexec4
    authdemo_shm onipcshm sun450 authdemo

    ************************************************** *****
    /etc/services
    sqlexec1 1541/tcp # authlive
    sqlexec2 1542/tcp # authtest
    sqlexec3 1543/tcp # authconv
    sqlexec4 1544/tcp # authdemo

    ************************************************** *****
    /home/apache_user/.bash_profile (environment variables)

    INFORMIXSQLHOSTS=/opt/informix/etc/sqlhosts
    export INFORMIXSQLHOSTS

    INFORMIXDIR=/opt/informix
    export INFORMIXDIR

    INFORMIXSERVER=sun450
    export INFORMIXSERVER

    PATH=$PATH:$INFORMIXDIR/bin
    export PATH

    LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql
    export LD_LIBRARY_PATH

  2. #2
    Join Date
    Aug 2003
    Location
    India
    Posts
    262

    Re: Informix error - INFORMIXSERVER value not listed in sqlhosts

    Hi,

    Also set you ONCONFIG env variable too.



    Originally posted by Wiggum24
    Hi

    Trying to setup an informix connection to our existing informix 9 server using apache/php. Any help would be greatly appreciated. Error message is:

    Warning: ifx_pconnect(): E [SQLSTATE=IX 000 SQLCODE=-25596] in /www/ifx.php on line 13
    Unable to connect to Informix database

    Informix error: E [SQLSTATE=IX 000 SQLCODE=-25596]

    The INFORMIXSERVER value is not listed in the sqlhosts file or the Registry.

    ************************************************** ****
    <?php

    $database = "authtest";
    $server = "sun450";
    $login = "informix";
    $password = "password";

    $dbs = $database . "@" . $server;

    $connect_id = ifx_pconnect($dbs,$login,$password);

    if (!$connect_id) {
    echo "Unable to connect to Informix database<br>\n";
    chk_ifx_err1($connect_id);
    } else {
    echo "Informix connection successful! <BR>";
    }

    ************************************************** *****
    /opt/informix/etc/sqlhosts
    authlive ontlitcp sun450 sqlexec1
    authlive_shm onipcshm sun450 authlive

    authtest ontlitcp sun450 sqlexec2
    authtest_shm onipcshm sun450 authtest

    authconv ontlitcp sun450 sqlexec3
    authconv_shm onipcshm sun450 authconv

    authdemo ontlitcp sun450 sqlexec4
    authdemo_shm onipcshm sun450 authdemo

    ************************************************** *****
    /etc/services
    sqlexec1 1541/tcp # authlive
    sqlexec2 1542/tcp # authtest
    sqlexec3 1543/tcp # authconv
    sqlexec4 1544/tcp # authdemo

    ************************************************** *****
    /home/apache_user/.bash_profile (environment variables)

    INFORMIXSQLHOSTS=/opt/informix/etc/sqlhosts
    export INFORMIXSQLHOSTS

    INFORMIXDIR=/opt/informix
    export INFORMIXDIR

    INFORMIXSERVER=sun450
    export INFORMIXSERVER

    PATH=$PATH:$INFORMIXDIR/bin
    export PATH

    LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql
    export LD_LIBRARY_PATH

  3. #3
    Join Date
    Dec 2002
    Location
    Portland, OR, USA
    Posts
    26

    Smile Not set up quite right...

    Hi, Wiggum24!

    After reading your post, this is what I have come to:

    The reason this is happening is a misunderstanding of the setup.

    sun450 is the UNIX name of your server. That's why it is properly present in column 3 of your sqlhosts file entries (that is good).

    However, the values in column 1 of that file {authlive, authlive_shm, authtest, etc.} are Informix server names, not databases. In theory, with this kind of setup, they might be hosting different versions of the same database for different purposes (production, dev, regression testing, etc. - you get the picture)... OK?

    So... what that means from the program side is the INFORMIXSERVER variable has to be set to whichever one of those you want to connect to
    {authlive, authlive_shm, authtest, etc.}. In your code, that value must be matched with your $server variable. What you use for $database really depends on what you named the database with the CREATE DATABASE command.

    Everything else looks good. You're almost there.

    Regards,
    Joe

  4. #4
    Join Date
    Mar 2004
    Posts
    3

    Re: Not set up quite right...

    yes we have multiple environments ok, made a couple of changes

    sqlhosts...
    authtest ontlitcp sun450 sqlexec2

    environment...
    INFORMIXSERVER=authtest

    php...
    $database = "dbname";
    $server = "authtest";


    Now I'm getting:
    **********************************************
    Informix error: E [SQLSTATE=IX 000 SQLCODE=25507]
    The specified service name or protocol is unknown.
    **********************************************

    I'm not sure on the variable $database... I've tried quite alot of names and nothing is seeming to work. It does take a step backward into a different error message if I change the $server variable. Something of note here, the informix server sun450 is *not* the same server as the webserver. Packet logs aren't showing up any connection attempts comming out of the webserver.

  5. #5
    Join Date
    Mar 2004
    Posts
    3
    Changed the entries in the SQL Hosts file, you need to use onsoctcp for connections to other servers.

    # servername connection server socket
    authtest onsoctcp sun450 sqlexec2

    Works fine Apache/PHP is running now with support for Informix, PostgreSQL, LDAP (active directory), MySQL, and SSL. Viva la open source!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •