Jaguars
04-27-03, 01:59
| Hi, I am getting this error message: Tk::Error: Can't locate object method "connect" via package "DBI" at win.pl line 7. Here is my subroutine: sub create_db() { $database="names"; $hostname="localhost"; $driver="mysql"; use DBI; my $dsn="DBI:mysql:database=$database;host=$hostname"; $dbh=DBI->connect($dsn); $drh=DBI->install_driver($driver); @databases=DBI->data_sources($driver); if($c) { my $sth=$c->prepare('select * from people'); if($sth->execute) { while(@row=$sth->fetchrow_array) { foreach(@row) { print "$_ -"; } print "\n"; } } $sth->finish; } return $c; } DBI and DBD-mysql are both installed...does anyone know what could be the problem? I looked through many such complaints and explanations online..but nothing has solved my problem yet. THanks. |