douchui3933 2015-06-27 02:45
浏览 80

PHP DB2 Connection已检测到通信错误

I have tried to connect to DB2/AS400 remote database with db2cli odbc module and odbc_connect but returns the next error:

Execution failed: [unixODBC][IBM][CLI Driver] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "10.10.100.5". Communication function detecting the error: "recv". Protocol specific error code(s): "", "", "0". SQLSTATE=08001

This is my PHP code:

<?php

$database = 'xxxx';
$user = 'xxxx';
$password = 'xxxx';
$hostname = '10.10.100.5';
$port = '55000';
$driver = 'DB2';

$conn_string = "DRIVER={$driver};DATABASE=$database;HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";

if (!$db = odbc_connect ($conn_string, $user, $password)) {
     print("Execution failed:
");
}

else echo 'Success!';


odbc_close($db);

Help me please!!

  • 写回答

1条回答 默认 最新

  • dpkrh2444 2015-07-06 18:18
    关注

    I am not familiar with AS400, but on Linux/UNIX this error happens when the TCP/IP communication has not been set properly at the server side. There are two things I would check (on a Linux/UNIX server, not sure about the AS400 equivalents):

    1. netstat -na
    2. db2set DB2COMM=TCPIP

    The first command will return the list of open TCP/IP listeners. Your port 55000 should be on the list. If it is not, it means the server is not open for communication.

    The second part enables TCP/IP communication in DB2. Note that there are dependencies on /etc/services and the SVCENAME DBM CFG parameter. The server must be restart for DB2COMM to take effect. When enabled properly, DB2 should start listening at the configured port.

    If none of this helps, then it is possible that a firewall is blocking access to the DB2 server.

    Again, I apologize if this reply does not apply to AS400.

    评论

报告相同问题?

悬赏问题

  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?