database - 连接到 Informix 中的远程数据库

标签 database informix database-administration

我们在 2 个环境中设置了 Informix 数据库。

测试

host1:1528/d7main:INFORMIXSERVER=m7uatserver

产品

host2:1528/d7main:INFORMIXSERVER=m7server

我尝试在从 UAT 连接的 PROD 中对客户表运行查询。

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

我收到以下错误。

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

查询的编写方式是否有问题?或者 DBA 是否需要设置其他内容才能发生此连接?

语法似乎是正确的,基于 Access remote tables在 IBM Informix 12.10 手册中。

最佳答案

finderr -908 的输出是:

-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.

同样,对于错误-931,消息的含义是:

-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.

那里有一些古怪古老的引用文献——OnLine for Netware 已经是古老的历史了,版本 6.00 也是如此。但是,基本要点是相似的。

一台或两台计算机上似乎都存在网络设置问题。

AFAICS,您的测试服务器和生产服务器位于同一台计算机上。它们使用单​​个 INFORMIXDIR 还是每个都有自己单独的 INFORMIXDIR? (两者都有可能;都没有错。)它们共享 INFORMIXSQLHOSTS 文件吗?

  • ...从头开始:您说 host1host2 — 两台不同的机器,因此,每台机器都必须有自己的 INFORMIXDIR。

我对 -931 消息的猜测是,它们不共享 INFORMIXSQLHOSTS 文件(这反过来可能意味着每个文件都有自己的 INFORMIXDIR),并且每个文件中的信息不包括其他服务器。

确保它们是否使用相同的 INFORMIXSQLHOSTS 文件(即默认情况下的文件 $INFORMIXDIR/etc/sqlhosts,除非被 $INFORMIXSQLHOSTS 覆盖)环境变量),文件中的信息是等效的,或者至少每个文件都包含另一个文件的条目。

  • ...您使用的是 Windows 还是基于 Unix 的系统?
  • ...您使用的是哪个版本的 Informix? (如果您不知道,运行 dbaccess -versiononstat -version 应该会告诉您。)
  • ...每台主机是否都了解对方 - /etc/hosts 文件或其网络等效文件是否包含相关信息,以便每台计算机知道如何连接到另一台计算机?

如果它们位于相同的 INFORMIXDIR 中并使用相同的 INFORMIXSQLHOSTS 文件,那么请回来我们再考虑一下。

关于database - 连接到 Informix 中的远程数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50401024/

相关文章:

php - PDO 无法返回last_insert_id

database - 在 Go 中,如何将 bson byte[] 数据解码到结构数组中?

database - 具有不同密码的不同 Redis 数据库?

sql - 如何在 having 子句中有 'distinct'

java - Informix 密码即将过期异常

PostgreSQL 错误 : could not extend file no space left on device

mysql - SQL查询问题-有六个表的困难查询

mysql - SQL 查询未找到任何内容,但返回 1 行且全部为空

sql - 存储过程的执行时间

sql - 使用环境变量时出现 DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER