我一直在尝试安装 IBM DB2 ODBC 驱动程序,以便我的 PHP 服务器可以连接到数据库,但没有成功。我尝试安装 db2_connect,但遇到了各种问题,我尝试安装 I Access for Linux,但 RPM 安装不正确,使用 alien breed 也没有任何有用的结果。我还尝试了 DB2 Runtime v8.1,但没有成功。
如果我尝试运行 rpm,它会声称我需要在 apt-get 中找不到的依赖项。Yum 也没什么用,因为我似乎没有安装任何存储库或列表...
运行简单的 RPM 在终端中给出以下结果:
# rpm -ivh iSeriesAccess-7.1.0-1.0.x86_64.rpm
rpm: RPM should not be used directly install RPM packages, use Alien instead!
rpm: However assuming you know what you are doing...
error: Failed dependencies:
/bin/ln is needed by iSeriesAccess-7.1.0-1.0.x86_64
/sbin/ldconfig is needed by iSeriesAccess-7.1.0-1.0.x86_64
/bin/rm is needed by iSeriesAccess-7.1.0-1.0.x86_64
/bin/sh is needed by iSeriesAccess-7.1.0-1.0.x86_64
libc.so.6()(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libc.so.6(GLIBC_2.2.5)(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libc.so.6(GLIBC_2.3)(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libdl.so.2()(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libdl.so.2(GLIBC_2.2.5)(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libgcc_s.so.1()(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libm.so.6()(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libm.so.6(GLIBC_2.2.5)(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libodbcinst.so.1()(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libodbc.so.1()(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libpthread.so.0()(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libpthread.so.0(GLIBC_2.2.5)(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libpthread.so.0(GLIBC_2.3.2)(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
librt.so.1()(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
librt.so.1(GLIBC_2.2.5)(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libstdc++.so.6()(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libstdc++.so.6(CXXABI_1.3)(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
libstdc++.so.6(GLIBCXX_3.4)(64bit) is needed by iSeriesAccess-7.1.0-1.0.x86_64
使用 alien 并运行 dkpg 让我感到头疼:
$ alien iSeriesAccess-7.1.0-1.0.x86_64.rpm --scripts
# dpkg -i iseriesaccess_7.1.0-2_amd64.deb
(Reading database ... 127664 files and directories currently installed.)
Preparing to replace iseriesaccess 7.1.0-2 (using iseriesaccess_7.1.0-2_amd64.deb) ...
Unpacking replacement iseriesaccess ...
post uninstall processing for iSeriesAccess 1.0...upgrade
/var/lib/dpkg/info/iseriesaccess.postrm: line 8: [: upgrade: integer expression expected
Setting up iseriesaccess (7.1.0-2) ...
post install processing for iSeriesAccess 1.0...configure
iSeries Access ODBC Driver has been deleted (if it existed at all) because its usage count became zero
odbcinst: Driver installed. Usage count increased to 1.
Target directory is /etc
odbcinst: Driver installed. Usage count increased to 3.
Target directory is /etc
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
因此看起来文件安装正确,我的 odbc 驱动程序出现了,但是 db2cli.ini 却无处可寻。
所以有几个问题。有没有更好的选择将 php 连接到 db2,比如我可以安装的 ubuntu 包?有人可以指导我如何使我的 ubuntu 服务器与 RPM 配合良好,以便我可以构建我的 db2 实例吗?
还要记住,我远程连接到 I 系列。我没有使用 DB2 Express C,即使我尝试过让 db2 php 函数工作。我没有 zend,但我认为我有 ubuntu 存储库中的所有其他包。帮帮忙,谢谢!
答案1
我这样做:
1.
sudo apt-get install php5-odbc alien
2.
alien –i –c iSeriesAccess-6.1.0-1.2.x86_64.rpm
3.
nano /etc/odbc.ini
[DATASOURCE NAME]
Description = iSeries Access ODBC Driver DSN for iSeries
Driver = iSeries Access ODBC Driver
System = IP ADDRESS OF YOUR iSERIES
UserID =
Password =
Naming = 0
DefaultLibraries = QGPL
Database = YOUR DATABASE
ConnectionType = 0
CommitMode = 2
ExtendedDynamic = 0
DefaultPkgLibrary = QGPL
DefaultPackage = A/DEFAULT(IBM),2,0,1,0,512
AllowDataCompression = 1
LibraryView = 0
AllowUnsupportedChar = 0
ForceTranslation = 0
Trace = 0
CCSID = 1208