SQLCODE = -5005从PHP连接到db2数据库时

问题描述 投票:0回答:1

我正在测试PHP + Db2连接。我正在关注此URL-https://github.com/php/pecl-database-ibm_db2/blob/master/README.md

我有此示例代码:

<?php
$database = 'casedb';
$user = 'db2test';
$password = 'XXXXXXX';
$conn = db2_connect($database, $user, $password);
echo "IN";
if ($conn) {
    echo "Connection succeeded.";
    db2_close($conn);
}
else {
    echo "Connection failed: " . db2_conn_errormsg();
}
echo "OUT";
?>

如果我将其作为独立的PHP程序运行,则连接成功。

# php connect.php
INConnection succeeded.OUT

如果我通过网络浏览器打开此PHP页面,则会显示此错误:http://9.30.XX.XX/connect.php

INConnection failed: [IBM][CLI Driver] SQL10007N Message "0" could not be retrieved. Reason code: "3". SQLCODE=-5005OUT

不确定此SQL5005错误的来源。

SQL5005C  The operation failed because the database manager failed to
      access either the database manager configuration file or the
      database configuration file.
Explanation: 
The DB2 database product uses two types of configuration files:
Database manager configuration file
         Created when a DB2 database manager instance is created, the
     database manager configuration file contains parameters that
     affect system resources at the instance level. There is also
     one database manager configuration file for each client
     installation, which contains information about the client
     enabler for a specific workstation. The database manager
     configuration file is named db2systm and is located in the
     instance directory.
Database configuration file
         Created when a database is created, the database configuration
     file contains parameters that affect the use of that database.
     The database configuration file for each database is named
     SQLDBCONF, and stored along with other control files for that
     database in the directory named "SQLnnnnn" (where nnnnn is a
     number assigned when the database was created.)

我为目标数据库配置了db2cli.ini。仍然没有成功。

有任何提示吗?谢谢。

php db2 db2-luw
1个回答
0
投票

在下面的问答中进行回顾应该很好:

How to use PHP Locale functions

它表明我们需要:setlocale(LC_ALL,$ locale)和localeconv()

并尝试设置以下一项:“美国”,“美国”,“美国”,“美国”或“我们”有关其他国家/地区,请参见以下内容:http://msdn.microsoft.com/en-us/library/cdax410z%28v=vs.90%29.aspx

希望这会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.