On 4/7/06, Practical Perl <[EMAIL PROTECTED]> wrote:
> Hello,all,
>
> I wrote a script to insert datas to mysql database.The insert frequency is
> about 45 times per second.
> Most of the insert actions are successful,but I still see some errors as
> follow:
>
> DBD::mysql::st execute failed: INSERT command denied to user
> 'abc'@'192.168.3.10' for table 'rcpt' at ./rcptsvr line 377
>
> Could anyone tell me why this error happened with my Perl script?Thanks.

If you are running MySQL 4.0 on MS Windows then this might be your problem

http://bugs.mysql.com/bug.php?id=5569

I found a couple other mentions of similar issues (mostly around MySQL
on MS Windows) in a quick google search.  Can you reproduce the error
consistently?  If so you might consider filing a bug on
bugs.mysql.com.

All in all it sounds like a database bug rather than a Perl bug, but a
work around might be something like this (assuming you have RaiseError
=> 1 in your connect)

my $sth = $dbh->prepare("insert into rcpt values (?, ?, ?, ?)")
my $tries = 5;
for my $data (get_data()) {
    for ( 1 .. $tries) {
        eval { $sth->execute(@$data) };

        # exit retry loop if successful
        unless ($@) {
            $tries = 0;
            break;
        }

        #die if any error other than denied
        die $@ unless $@ =~ /INSERT command denied to user/;
    }
    if ($tries) {
        die
            "Insert failed due to permission issue, tried $tries times\n" .
            "Data was: @$data";
    }
}

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to