If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Informix error - INFORMIXSERVER value not listed in sqlhosts

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-24-04, 17:43
Wiggum24 Wiggum24 is offline
Registered User
 
Join Date: Mar 2004
Posts: 3
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
Reply With Quote
  #2 (permalink)  
Old 03-24-04, 22:16
lloydnwo lloydnwo is offline
Registered User
 
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.



Quote:
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
Reply With Quote
  #3 (permalink)  
Old 03-26-04, 13:24
astrue astrue is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 03-29-04, 21:54
Wiggum24 Wiggum24 is offline
Registered User
 
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.
Reply With Quote
  #5 (permalink)  
Old 03-31-04, 17:13
Wiggum24 Wiggum24 is offline
Registered User
 
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!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On