Hi List,

I'm experiencing the problem as described at
http://forums.mysql.com/read.php?37,39779,136287#msg-136287

I'm using the following script to test:

<?php
$p = 0;
$n = 0;
for ($i = 0; $i < 120; $i++) {
        $conn = mysql_connect("www.myserver.org", "user", "secret");
        if ($conn) {
                echo "Success!\n";
                mysql_close($conn);
                $p++;
        } else {
                echo "Failed test $i\n";
                $n++;
        }
        sleep(1);
}
echo "\n$p successes, $n failures\n";
?>

Results are very unpredictable. E.g. out of 120 connection attempts, I'll have
114 successes and 6 failures.

The solution that's mentioned is to enable connection pooling, yet since I'm
using the x64 edition, that doesn't work for me.

Has anybody else run into this problem? And how did you solve it?

Thanks in advance,

Yves

------ Original Message ------
Received: Mon, 09 Mar 2009 05:55:55 AM CDT
From: Daniel Carrera <daniel.carr...@theingots.org>
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Re : Problem with PDO exceptions

Neil Smith [MVP, Digital media] wrote:
> When you create your DB connection $db, follow the connection line 
> directly after with this :
> $db->setAttribute(PDO::ATTR_ERRMODE , PDO::ERRMODE_EXCEPTION);
> 
> The default is I believe PDO::ERRMODE_SILENT which is confusing to most 
> people the first time.


Thanks! It works now.

Cheers,
Daniel.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to