简体   繁体   English

PHP 5.6.x失去了连接ODBC源的能力

[英]PHP 5.6.x lost ability to connect to ODBC source

I have a strange problem. 我有一个奇怪的问题。 My server has been running PHP 5.6 for years no problem. 我的服务器已运行PHP 5.6多年没问题。 (WinServer Std 2K8 SP2, IIS 6, MySQL 5.6 {separate server}, PHP 5.6) (WinServer Std 2K8 SP2,IIS 6,MySQL 5.6 {独立服务器},PHP 5.6)

We connect it to a DB2 server at our parent company. 我们将它连接到我们母公司的DB2服务器。 Today (2017-02-14) the ODBC connection (PDO_ODBC) started returning "could not find driver". 今天(2017-02-14)ODBC连接(PDO_ODBC)开始返回“找不到驱动程序”。

Excel is able to use the same ODBC connection to query the database - the ODBC connection is working. Excel能够使用相同的ODBC连接来查询数据库 - ODBC连接正在运行。

I tried using both the PDO method and procedural method to connect. 我尝试使用PDO方法和程序方法进行连接。 Failures in seeing the driver both ways. 无法双向看到驾驶员。

From phpinfo() : ODBC Data PDO Data 来自phpinfo()ODBC Data PDO Data

Code snippet: 代码段:

$dsn = "odbc:workingODBCdsn";
$user = "xxxx";
$password = "yyyy";
$conn = null;
$results = array();

try {
    $conn = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
    die($e->getMessage());
}

if ($conn) {
    $qry = $conn->query($sql);
    if ($qry) {
        $qry->setFetchMode(PDO::FETCH_ASSOC); 
        foreach ($qry as $row) {
            $results[] = $row;
        }
    }
}

print "<pre>" . print_r($results, true) . "</pre>";

//ALT Method
$conn = odbc_connect($dsn, $user, $password);
$results = odbc_exec($conn, $sql);

print "<pre>" . print_r($results, true) . "</pre>";

Thanks in advance for any help. 在此先感谢您的帮助。

Are you using the unixODBC or ibm_db2 ( http://php.net/manual/en/ref.pdo-odbc.php )? 您使用的是unixODBC还是ibm_db2( http://php.net/manual/en/ref.pdo-odbc.php )? It it recommended to use IBM DB2 Universal Database with “ibm_db2” extension. 它建议使用带有“ibm_db2”扩展名的IBM DB2 Universal Database。 It's faster and more efficient than using generic driver. 它比使用通用驱动程序更快,更有效。 It calls the native IBM DB2 functions with the extension. 它使用扩展名调用本机IBM DB2函数。

Check out the db2_* functions from php.net IBM DB2 functions manual php.net IBM DB2函数手册中查看db2_ *函数

Server's PHP instance switched from IIS to IISExpress. 服务器的PHP实例从IIS切换到IISExpress。 Switching it back to (full) IIS, and enduring all appropriate PDO drivers were enabled fixed the problem. 将其切换回(完整)IIS,并启用所有适当的PDO驱动程序已启用修复此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP 5.6.x源与Apache一起安装,但是发生opensl错误,将指针解引用为不完整类型 - PHP 5.6.x source install with Apache, but openssl error occurs, dereferencing pointer to incomplete type 如何在升级到5.6.x后修复php中的引用传递 - How to fix pass by reference in php after upgrading to 5.6.x 将PHP 5.5.x更新到5.6.x后,在OS X El Capitan上更新PHP的路径 - Update path to PHP on OS X El Capitan after updating PHP 5.5.x to 5.6.x PHP 5.3.x的安全性是否低于PHP 5.6.x - Is PHP 5.3.x less secure than PHP 5.6.x 在CentOS 6.7上从php 5.5.x升级到5.6.x. - Upgrading from php 5.5.x to 5.6.x on CentOS 6.7 使用代码点火器使用PHP 5.6.x(xamp)配置MSSQL - configuration MSSQL with PHP 5.6.x(xamp) using code-igniter 开发服务器不会停止缓存(Vagrant - Apache 2.4 - Centos 7.6 - php 5.6)在 MacOSX 上。 - DEVELOPMENT server won't stop caching (Vagrant - Apache 2.4 - Centos 7.6 - php 5.6.x ) on MacOSX 将Concrete5从5.5.2.1升级到5.6.x的问题 - Issues upgrading Concrete5 from 5.5.2.1 to 5.6.x Concrete5 5.6.x-在程序包控制器中以编程方式设置属性类型关联 - Concrete5 5.6.x - Setting Attribute Type Associations programmatically in a package controller PHP ODBC_connect与现有的ODBC驱动程序 - PHP ODBC_connect with existing ODBC drivers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM