MySQL Forums
Forum List  »  Perl

Calling Stored Procs from Perl DBI
Posted by: Pat Jefferies
Date: August 10, 2009 09:33AM

Hi,

I am maintaining a legacy system that uses the Perl DBI to query a MySQL DB. Originally it was just doing simple queries, but I now need it to call a stored procedure. However, when I attempt to add a prepare/execute to call the SP, the whole script fails. I have already tried several solutions I found on the forums, such as setting the Client_Multi_Results flag, but nothing has worked.

I am getting the following error from the script:
"Failed to execute CGI : Win32 Error Code = -2147467259"

Here is the code that breaks the script:
my $user = "USER";
my $pass = "PASSWORD";
my $dsn = 'DBI:mysql:database=esupport;host=localhost;port=3306;client_multi_results=1';
my $dbh = DBI->connect($dsn, $user, $pass) || die "Can't connect to database: $DBI::errstr\n";
my $sql = q/CALL sp_getsupportstats(0,0)/;
my $sth = $dbh->prepare($sql) || die "Couldn't prepare statement: " . $dbh->errstr;
$sth->execute;

I am running MySQL version 5.0.24-community-nt.

Options: ReplyQuote


Subject
Written By
Posted
Calling Stored Procs from Perl DBI
August 10, 2009 09:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.