MySQL Forums
Forum List  »  Perl

Calling Password() via Perl Hangs
Posted by: Brett Bowman
Date: January 22, 2009 01:20PM

I'm writing a simple Perl CGI script to handle some basic queries to my DB for report generation, and I can't get my login to work. First I create a DBI with a dummy user name and password, which can only select and only from the mysql database.

#Part 1 - this returns successfully the hash of the password for the user
my $userSt = $dbh->prepare('SELECT password FROM user WHERE user=?')
or die "Couldn't prepare statement: " . $dbh->errstr;
or die "Couldn't execute statement: " . $userSt->errstr;
my @user = $userSt->fetchrow_array();
print $user[0];
#End Part 1

#Part 2 - This part should hash the password given, for comparison with Part 1
#This prepare statement works along - I've tested it.
my $passSt = $dbh->prepare('SELECT PASSWORD(?)')
or die "Couldn't prepare statement: " . $dbh->errstr;
#When I try to execute it, however, it hangs.
#My webbrowser says "waiting for my_ip_address_here"
#and nothing happens
or die "Couldn't execute statement: " . $passSt->errstr;
my @pass = $passSt->fetchrow_array();
print $pass[0];
#End Part 2

All of these statements worked exactly as is when typed into MySQL directly, but the second part hangs when I try to do it program-aticlly, and I can't figure out why for the life of me.

Help please?

Brett Bowman

Options: ReplyQuote

Written By
Calling Password() via Perl Hangs
January 22, 2009 01:20PM

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.