SQLCODE = -5005 при подключении к базе данных db2 из PHP - PullRequest
0 голосов
/ 20 января 2020

Я тестирую 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 для целевой базы данных. По-прежнему безуспешно.

Любые подсказки, пожалуйста? Спасибо.

1 Ответ

0 голосов
/ 21 января 2020

Должно быть приятно рассмотреть ниже вопросы и ответы:

Как использовать PHP Функции локали

Это говорит о том, что нам нужно:
setlocale (LC_ALL, $ locale) и localeconv ()

И попробуйте установить одно из: "США", "Америка", "Соединенные Штаты", "Соединенные Штаты" ", или" us "
См. другие страны / значения ниже:
http://msdn.microsoft.com/en-us/library/cdax410z%28v=vs.90%29.aspx

Надеюсь, это поможет.

...