Here's what I use:
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();




>>From the DBI manual:
> 
>       $dbh = DBI->connect($data_source, $username, $auth, \%attr);
> 
> You're not telling DBI what the DSN is (Data source name)
> 
> John Mayson wrote:
>> 
>> 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
> 
> -- 
> Colin Faber
> (303) 859-1491
> fpsn.net, Inc.
> 
> ---------------------------------------------------------------------
> 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

Reply via email to