Here's what I use (a little different): use DBI; use diagnostics; use strict; my ($dbh,$sth); my ($dbname)="pickle"; my ($login)="picklesql"; my ($password) ="pi56fb"; my (@ary); # $dbh = DBI->connect("DBI:mysql:$dbname",$login,$password) or die "Can't connect to $dbh: $dbh->errstr\n"; $sth = $dbh->prepare("SELECT * FROM catalog") or die "Can't connect to $dbh: $sth->errstr\n"; $sth-> execute() or die "Can't connect to $dbh: $sth->errstr\n"; $sth -> finish(); $dbh->disconnect();
> > > The $dbh connect code should be like this: > $dbh=DBI->connect("DBI:mysql:datrtabase=radio';host=localhost",root,"passwor d", > {RaiseError=>1}); > > If there is an error, you can catch it using, die statement. > > > > Placed At : > > > John Mayson <[EMAIL PROTECTED]> on 01/01/2002 08:24:50 AM > > Please respond to [EMAIL PROTECTED] > > To: MySQL List <[EMAIL PROTECTED]>, Central Florida Geeks > <[EMAIL PROTECTED]> > cc: (bcc: Durga Prasad/Satyam) > > Subject: Perl problem > > > > > I've decided to graduate to the next step and access my mySQL databases > with Perl. I > am attempting this on a Win2000 machine. > > Here's my code... > > #!C:/perl/bin/perl.exe -w > > use strict; > use CGI qw(:standard); > use DBI; > > my $dbh = DBI->connect('Radio', 'root', ''); > > I get this error message... > > Can't locate object method "connect" via package "DBI" (perhaps you > forgot to load > "DBI"?) at C:\Program Files\Apache Group\Apache2\cgi-bin\rdb.pl line 7. > > DBI.pm lives under c:\perl\lib which is in my @INC. > > Ideas? > > John > -- > John Mayson KC4VJO Linux/Perl/HP-UX/ICT > Austin, Texas 78729 30.4560N 97.7851W > [EMAIL PROTECTED] http://www.nyx.net/~jmayson > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> To > unsubscribe, e-mail > <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php