Sam
Sam

Reputation: 101

Connecting to a remote database in Informix

We have Informix database setup in 2 environments.

TEST

host1:1528/d7main:INFORMIXSERVER=m7uatserver

PROD

host2:1528/d7main:INFORMIXSERVER=m7server

I tried to run a query on customer table in PROD connecting from UAT.

select  * from d7main@m7server:customer where active = 'Y';

I get below error.

Attempt to connect to database server (m7server, conerr=-931, oserr=0) failed.
[SQL State=08004, DB Errorcode=-908] 

Is there something wrong with the way the query is written? Or does the DBA need to setup something else for this connection to happen?

The syntax seems correct based on Access remote tables in the IBM Informix 12.10 Manual.

Upvotes: 2

Views: 4739

Answers (1)

Jonathan Leffler
Jonathan Leffler

Reputation: 754820

The output from finderr -908 is:

-908 Attempt to connect to database server (servername) failed.

The program or application is trying to access another database server but has failed. Note the server name in the current statement.

The desired database server is unavailable, or the network is down or is congested. Ask your DBA and system administrator to verify that the server and network are operational. If the network is congested, use the environment variables INFORMIXCONTIME and INFORMIXCONRETRY to tune connection timing. For information on setting these environment variables, see the IBM Informix Guide to SQL: Reference.

This message appears in Version 6.0 and later versions.

Similarly, for error -931, the message means:

-931 Cannot locate servicename service/tcp service in /etc/services.

The service servicename is not listed in the network configuration file /etc/services (UNIX) or \etc\services (DOS). Check the $INFORMIXDIR/etc/sqlhosts file, and check that the service name for the desired server is correct. If so, contact your network administrator to find out why the service is not known. If you are using IBM Informix OnLine for NetWare, check the \etc\services file on the client for the required entries.

There are some quaintly archaic references there — OnLine for Netware is ancient history, as is version 6.00. However, the basic gist is similar.

It would seem that there are network setup issues on one or both machines.

AFAICS, you have the test and production servers on the same machine. Do they use a single INFORMIXDIR or does each have its own separate INFORMIXDIR? (Both are possible; neither is wrong.) Do they share the INFORMIXSQLHOSTS file?

  • … Scratch that: you say host1 and host2 — two different machines, therefore, of necessity, each has its own INFORMIXDIR.

My guess from the -931 message is that they do not share the INFORMIXSQLHOSTS file (which in turn probably means each has its own INFORMIXDIR), and that the information in each file does not include the other server.

Make sure that if they are not using the same INFORMIXSQLHOSTS file (that is, the file $INFORMIXDIR/etc/sqlhosts by default, unless overridden by the $INFORMIXSQLHOSTS environment variable), that the information in the files is equivalent — or, at least, that each includes the entry for the other.

  • … Are you on Windows or a Unix-based system?
  • … Which version of Informix are you using? (Running dbaccess -version or onstat -version should tell you if you don't know anyway.)
  • … Is each host aware of the other — does the /etc/hosts file or its networking equivalent contain the relevant information so that each machine knows how to connect to the other?

If they're in the same INFORMIXDIR and using the same INFORMIXSQLHOSTS file, then come back and we'll think again.

Upvotes: 2

Related Questions