>  기사  >  백엔드 개발  >  PDO 报错 DibiDriverException: SQLSTATE[HY000]:

PDO 报错 DibiDriverException: SQLSTATE[HY000]:

WBOY
WBOY원래의
2016-06-06 20:46:081361검색

数据库配置页

<code><?php require './lib/dibi.min.php';

// DB
try {
    $dsn = new PDO("mysql:host=localhost;dbname=runtime", 'root', '****', array(
        PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"
    ));

    dibi::connect(array(
        'driver' => 'pdo',
        'pdo' => $dsn,
        'lazy' => true,
        'profiler' => array(
            'run' => TRUE,
        ),
    ));

    $dibi = true;

} catch (Exception $e) {
    echo $e->getMessage();
    exit();
}

?>
</code>

报错
http://up.vpsbar.im/tmp/exception-2014-04-22-04-24-23-f770dde7183df6636b625fac44d0ec02.html

日志

<code>[2014-04-22 04-05-50] DibiDriverException: SQLSTATE[HY000]: Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /web/lib/dibi.min.php:1102  @  http://up.vpsbar.im/en/public  @@  exception-2014-04-22-04-05-50-f3cf5137b37058de5d269f6efb15af27.html
[2014-04-22 04-05-59] DibiDriverException: SQLSTATE[HY000]: Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /web/lib/dibi.min.php:1102  @  http://up.vpsbar.im/en/public  @@  exception-2014-04-22-04-05-50-f3cf5137b37058de5d269f6efb15af27.html
[2014-04-22 04-06-10] DibiDriverException: SQLSTATE[HY000]: Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /web/lib/dibi.min.php:1102  @  http://up.vpsbar.im/en/public  @@  exception-2014-04-22-04-05-50-f3cf5137b37058de5d269f6efb15af27.html
[2014-04-22 04-06-19] DibiDriverException: SQLSTATE[HY000]: Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /web/lib/dibi.min.php:1102  @  http://up.vpsbar.im/en/public  @@  exception-2014-04-22-04-05-50-f3cf5137b37058de5d269f6efb15af27.html
[2014-04-22 04-07-25] DibiDriverException: SQLSTATE[HY000]: Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /web/lib/dibi.min.php:1102  @  http://up.vpsbar.im/en/public  @@  exception-2014-04-22-04-05-50-f3cf5137b37058de5d269f6efb15af27.html
</code>

回复内容:

数据库配置页

<code><?php require './lib/dibi.min.php';

// DB
try {
    $dsn = new PDO("mysql:host=localhost;dbname=runtime", 'root', '****', array(
        PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"
    ));

    dibi::connect(array(
        'driver' => 'pdo',
        'pdo' => $dsn,
        'lazy' => true,
        'profiler' => array(
            'run' => TRUE,
        ),
    ));

    $dibi = true;

} catch (Exception $e) {
    echo $e->getMessage();
    exit();
}

?>
</code>

报错
http://up.vpsbar.im/tmp/exception-2014-04-22-04-24-23-f770dde7183df6636b625fac44d0ec02.html

日志

<code>[2014-04-22 04-05-50] DibiDriverException: SQLSTATE[HY000]: Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /web/lib/dibi.min.php:1102  @  http://up.vpsbar.im/en/public  @@  exception-2014-04-22-04-05-50-f3cf5137b37058de5d269f6efb15af27.html
[2014-04-22 04-05-59] DibiDriverException: SQLSTATE[HY000]: Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /web/lib/dibi.min.php:1102  @  http://up.vpsbar.im/en/public  @@  exception-2014-04-22-04-05-50-f3cf5137b37058de5d269f6efb15af27.html
[2014-04-22 04-06-10] DibiDriverException: SQLSTATE[HY000]: Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /web/lib/dibi.min.php:1102  @  http://up.vpsbar.im/en/public  @@  exception-2014-04-22-04-05-50-f3cf5137b37058de5d269f6efb15af27.html
[2014-04-22 04-06-19] DibiDriverException: SQLSTATE[HY000]: Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /web/lib/dibi.min.php:1102  @  http://up.vpsbar.im/en/public  @@  exception-2014-04-22-04-05-50-f3cf5137b37058de5d269f6efb15af27.html
[2014-04-22 04-07-25] DibiDriverException: SQLSTATE[HY000]: Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /web/lib/dibi.min.php:1102  @  http://up.vpsbar.im/en/public  @@  exception-2014-04-22-04-05-50-f3cf5137b37058de5d269f6efb15af27.html
</code>

using PDOStatement::fetchAll()

setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /web/lib/dibi.min.php:1102

上述两者选其一。。。。。看日志。。。。

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.