我正在使用带有PHP 5.1.6(cli)的CentOS 5.6版(最终版)(内置:2012年2月2日18:24:47)。 我需要连接同一本地网络中的DB2数据库服务器。 Db2版本是V5R3。 我已经安装了iSeriesAccess客户端以及unixODBC。
我的odbc.ini配置:
[iSeries Access ODBC Driver]
Description = iSeries Access for Linux ODBC Driver
Driver = /opt/ibm/iSeriesAccess/lib/libcwbodbc.so
Setup = /opt/ibm/iSeriesAccess/lib/libcwbodbcs.so
NOTE1 = If using unixODBC 2.2.11 or later and you want the 32 and 64-bit ODBC drivers to share DSN's,
NOTE2 = the following Driver64/Setup64 keywords will provide that support.
Driver64 = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup64 = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading = 2
DontDLClose = 1
UsageCount = 1
我正在运行以下代码:
<?php
$database = 'dbname';
$server = 'local_ip';
$user = 'username';
$password = 'password';
$driver = 'iSeries Access ODBC Driver';
$conn = odbc_connect("Driver={iSeries Access ODBC Driver};Server=$server;Database=$database;", $user, $password);
if (!$conn......)
我收到以下错误消息: “ [unixODBC] [IBM] [System i Access ODBC Driver]缺少connection.Error所需的系统名称!”
有什么我想念的吗?欢迎您的建议。
答案 0 :(得分:3)
Server
属性应为System
。
可以在i5 / OS信息中心找到更多信息 Connection string keywords和General properties。
答案 1 :(得分:2)
Can try with a working odbc.ini configuration
[DB2]
Description = ODBC for DB2
Driver = /opt/ibm/iSeriesAccess/lib/libcwbodbc.so
Setup = /opt/ibm/iSeriesAccess/lib/libcwbodbcs.so
FileUsage = 1
Threading = 2
DontDLClose = 1
UsageCount = 1
[mydb]
Driver = DB2
SYSTEM = 172.16.10.1
USER = username
PASSWORD = userpass
PORT = 50000
DATABASE = db11
Option = 1
答案 2 :(得分:0)
检查此主题:http://www.jitterbit.com/PhpBB/viewtopic.php?f=4&t=87
“虽然这个帖子有点陈旧,但我确实让我的AS / 400连接正常工作。我必须使用”DSN“选项并手动构建连接字符串。”