环境: window 2003 + mysql 5.0.27 + PHP 5.20Warning: PDOStatement::execute() [function.PDOStatement-execute]: SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query in x:\xx.php on line 99
$db = new PDO(....);
$st = $db->prepare("Call sp_test(0);");
$st->execute();
$st = $db->prepare("Call sp_test(1);");
$st->execute();在执行第一个存储过程的时候能得到期望的数据;但在调用第二个的时候就出现给出的错误;

解决方案 »

  1.   

    就一个最简单的 Select 语句,
      

  2.   

    一般来说是因为查询时间太长.或者是参数传递不正确,MYSQL不认识语句导致.
      

  3.   

    参照 http://netevil.org/node.php?nid=795 同样不行;
    -----------------------------------------------------------
    I've recently discovered a few things about how the mysql client library does things that seem a bit silly to me, so I'm going to share them with you.
    native prepared statements cannot take advantage of the query cache, resulting in lower performance.
    native prepared statements cannot execute certains types of queries, like "SHOW TABLES"
    native prepared statements don't correctly communicate column lengths for certain other "SHOW" queries, resulting in garbled results.
    calling stored procedures multiple times using native prepared statements causes the connection to drop.
    I recommend that you use the following attribute when working with PDO::MYSQL, available in the current PHP 5.1.3 release candidates and snapshots:$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);This causes the PDO native query parser to be used instead of the native prepared statements APIs in the mysql client, and effectively eliminates those problems.I'll admit that the last point could well be a bug in my code; since I'll be at the MySQL Users Conference next week, I should be able to sit down with the right people and fix it.
    ----------------------------------------------------------------------
    而且我使用 mysqli 也遇到同样的问题
      

  4.   


    就一个最简单的 Select 语句,
    ------------------------------语句再简单你贴出来吧。