<i id='VwpG1'><tr id='VwpG1'><dt id='VwpG1'><q id='VwpG1'><span id='VwpG1'><b id='VwpG1'><form id='VwpG1'><ins id='VwpG1'></ins><ul id='VwpG1'></ul><sub id='VwpG1'></sub></form><legend id='VwpG1'></legend><bdo id='VwpG1'><pre id='VwpG1'><center id='VwpG1'></center></pre></bdo></b><th id='VwpG1'></th></span></q></dt></tr></i><div id='VwpG1'><tfoot id='VwpG1'></tfoot><dl id='VwpG1'><fieldset id='VwpG1'></fieldset></dl></div>
      <legend id='VwpG1'><style id='VwpG1'><dir id='VwpG1'><q id='VwpG1'></q></dir></style></legend>

      • <bdo id='VwpG1'></bdo><ul id='VwpG1'></ul>

        <small id='VwpG1'></small><noframes id='VwpG1'>

        <tfoot id='VwpG1'></tfoot>

        使用 PHP 不使用 ODBC 成功连接到 DB2?

        时间:2024-05-11
          <tbody id='gLGgj'></tbody>
        1. <i id='gLGgj'><tr id='gLGgj'><dt id='gLGgj'><q id='gLGgj'><span id='gLGgj'><b id='gLGgj'><form id='gLGgj'><ins id='gLGgj'></ins><ul id='gLGgj'></ul><sub id='gLGgj'></sub></form><legend id='gLGgj'></legend><bdo id='gLGgj'><pre id='gLGgj'><center id='gLGgj'></center></pre></bdo></b><th id='gLGgj'></th></span></q></dt></tr></i><div id='gLGgj'><tfoot id='gLGgj'></tfoot><dl id='gLGgj'><fieldset id='gLGgj'></fieldset></dl></div>
          • <bdo id='gLGgj'></bdo><ul id='gLGgj'></ul>
            <legend id='gLGgj'><style id='gLGgj'><dir id='gLGgj'><q id='gLGgj'></q></dir></style></legend>

                <tfoot id='gLGgj'></tfoot>

                • <small id='gLGgj'></small><noframes id='gLGgj'>

                  本文介绍了使用 PHP 不使用 ODBC 成功连接到 DB2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  需要知道 1) 是否有人成功建立了连接,2) 是否使用 PHP 查询了远程 DB2 服务器,以及 3) 如果是,如何?

                  Need to know if 1) anyone successfully made a connection and 2)queried a remote DB2 server using PHP, and 3) if so how?

                  我为 db2 安装了 PECL 扩展

                  I installed the PECL extension for db2

                  <代码>[db2]扩展=ibm_db2.so

                  但不知道如何使用它.我找到的所有示例都使用 ODBC 样式的 dsn,我不想使用 ODBC.

                  but can't figure out how to use it. All the examples I find use ODBC style dsn, I don't want to use ODBC.

                  更新:根据此处的文档(http://www.redbooks.ibm.com/abstracts/sg247218.html)名义上可以使用 ibm_db2 驱动程序(无 ODBC),但其中描述的方法不完整或已过时.

                  UPDATE: According to documentation here (http://www.redbooks.ibm.com/abstracts/sg247218.html) it is nominally possible to use the ibm_db2 driver (sans ODBC) but the methodology described therein is either incomplete or outdated.

                  推荐答案

                  使用 PHP 你只有一个选择:ODBC.

                  Using PHP you only have one option: ODBC.

                  以下是关于如何在 Ubuntu 上连接到 DB2 for i(在 IBM i 上)的分步说明:

                  Here are step by step instructions for how to connect to DB2 for i (on the IBM i) on Ubuntu:

                  从 IBM 下载免费的 iSeriesAccess-6.1.0-1.2.i386.rpm 文件(您必须创建一个免费帐户才能获得它)

                  Download the free iSeriesAccess-6.1.0-1.2.i386.rpm file from IBM (you'll have to create a free account to get it)

                  将 RPM 文件转换为 Ubuntu 可以理解的内容:sudo alien iSeriesAccess-6.1.0-1.2.i386.rpm

                  Convert the RPM file to something Ubuntu understands: sudo alien iSeriesAccess-6.1.0-1.2.i386.rpm

                  安装生成的 .deb:sudo dpkg -i iseriesaccess_6.1.0-2.2_i386.deb

                  Install the resulting .deb: sudo dpkg -i iseriesaccess_6.1.0-2.2_i386.deb

                  将已安装的 iSeries 库复制到 Ubuntu 期望它们的位置:sudo cp/opt/ibm/iSeriesAccess/lib/*/usr/lib

                  Copy the installed iSeries libraries to where Ubuntu expects them: sudo cp /opt/ibm/iSeriesAccess/lib/* /usr/lib

                  编辑/etc/odbc.ini 文件以包含:

                  Edit the /etc/odbc.ini file to contain:

                  [primary]
                  Description             = primary
                  Driver                  = iSeries Access ODBC Driver
                  System                  = IP_ADDRESS
                  UserID                  = USERNAME
                  Password                = PASSWORD
                  Naming                  = 0
                  DefaultLibraries        = QGPL
                  Database                = XXXXXXXXXX
                  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
                  

                  编辑/etc/odbcinst.ini 文件以包含:

                  Edit the /etc/odbcinst.ini file to contain:

                  [iSeries Access ODBC Driver]
                  Description     = iSeries Access for Linux ODBC Driver
                  Driver          = /usr/lib/libcwbodbc.so
                  Setup           = /usr/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        = /usr/lib/lib64/libcwbodbc.so
                  Setup64         = /usr/lib/lib64/libcwbodbcs.so
                  Threading       = 2
                  DontDLClose     = 1
                  UsageCount      = 1
                  

                  然后创建与 PDO 的连接:

                  And then to create the connection with PDO:

                  $pdo = new PDO("odbc:DRIVER={iSeries Access ODBC Driver};SYSTEM=$server;PROTOCOL=TCPIP", $username, $password);
                  

                  这篇关于使用 PHP 不使用 ODBC 成功连接到 DB2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Linux 上 DB2 驱动程序的许可错误 下一篇:php pdo 连接到 DB2 不同的 CODEPAGE

                  相关文章

                  <legend id='dUP4z'><style id='dUP4z'><dir id='dUP4z'><q id='dUP4z'></q></dir></style></legend>
                    <tfoot id='dUP4z'></tfoot>
                    1. <small id='dUP4z'></small><noframes id='dUP4z'>

                        <bdo id='dUP4z'></bdo><ul id='dUP4z'></ul>

                      <i id='dUP4z'><tr id='dUP4z'><dt id='dUP4z'><q id='dUP4z'><span id='dUP4z'><b id='dUP4z'><form id='dUP4z'><ins id='dUP4z'></ins><ul id='dUP4z'></ul><sub id='dUP4z'></sub></form><legend id='dUP4z'></legend><bdo id='dUP4z'><pre id='dUP4z'><center id='dUP4z'></center></pre></bdo></b><th id='dUP4z'></th></span></q></dt></tr></i><div id='dUP4z'><tfoot id='dUP4z'></tfoot><dl id='dUP4z'><fieldset id='dUP4z'></fieldset></dl></div>