ActiveState Community

Help with: DBD::mysqlPP::st execute failed: #08S01Bad handshake at test1.pl line 35

Posted by Frank on 2008-05-04 16:30

Hello!

I'm going crazy with this problem. I'm unable to insert data into MySQL. I'm using Windows XP and ActivePerl5.10.000 Build 1002. It seems to be some kind of problem with mysqlPP and MySQL handshake. Here is my code:

#!C:\Perl\bin  -w

use DBI;
use CGI;
use strict;
use CGI qw(:standard);

my $fname = param('fname');
my $lname = param('lname');
my $btnSubmit = param('btnSubmit');
my $cgi = new CGI;

if($cgi->param)
{
my $dbh = DBI->connect("DBI:mysqlPP:database=test:host=localhost", "root", "password",  {'RaiseError' => 1});

my $sth = $dbh->prepare("INSERT INTO User (fname, lname) values(?, ?)");
	$sth->execute($fname, $lname);
}

print header();
print start_html(-title=>"Test Page", bgcolor=>"#4377083");

print <<HTML_Header;

<form method="post" action="test1.pl">
Enter your first name:<br>
<input type="text" name="fname="><br>
Enter you last name:<br>
<input type="text" name="lname"><br>
<input type="submit" value="Save">
</form>
</body>

</html>
HTML_Header
print end_html();

If I run this scipt with perl with paramters from the command promp I get the following error:

DBD::mysqlPP::st execute failed: #08S01Bad handshake at test1.pl line 35.
DBD::mysqlPP::st execute failed: #08S01Bad handshake at test1.pl line 35.

I can use php with mysql all day with any problems. I turn off the firewall without success. Any ideas? Please help!!!!