Hi,
I want to connect perl with the mysql to select and so on but the connection don't work
code
#!/usr/bin/perl
BEGIN {
# PERL MODULES WE WILL BE USING
use DBI;
$dbh = DBI->connect('DBI:mysql:C:\Program Files\MySQL\MySQL Server 5.0\data\db1','','pass') or die $DBI::errstr;}
# (insert query examples here...)
$sth = $dbh->prepare('SELECT gene_name FROM protein_names );
$sth->execute();
$result = $sth->fetchrow_hashref();
print "Value returned: $result->{description}\n";
end{
$dbh->disconnect();
}
I want from this code to get all gene_name in the table and put them in a hash table.
Note:
$dbh = DBI->connect('DBI:mysql:C:\Program Files\MySQL\MySQL Server 5.0\data\db1','','pass') or die $DBI::errstr;
here i defined the path to the db file and pass is the password i set to the mysql when i treat with and i didn't use a user name for this database
Thanks in advance