don't know if this is it, but i am using" $dbh = DBI->connect("DBI:mysql:$db_name") or die "Cannot connect to database". DBI->errstr; note that is 'DBI:mysql', not 'DBD:mysql'. On Monday, March 4, 2002, at 02:37 PM, Brian Volk wrote: > Hi All, > > I'm having some trouble connecting to mysql database. Here is a copy of > the script I'm using... One of the errors I'm getting is "no database > driver specified". Any help would be greatly appreciated. Thanks! > Brian > bvolk@bvolk.com > > > #!/usr/bin/perl > > use DBI; > > # Gather some information from the user : > print "Enter your MySQL username: "; > $username = <STDIN>; > print "Enter your MySQL password; "; > $password = <STDIN>; > > # Connect to the database > > my $dbh = DBI->connect ( "DBD:mysql :database=perl :host=localhost", > $username, > $password) || die "Couldn't connect to database"; > > print "Database connection established." > > # Perpare statement > > my $sth = $dbh->prepare( "SELECT * FROM perl_table" ); > > # Send statement to database > > $sth->execute || die "Couldn't execute statement"; > > # Print out the data > > my @row > while ( @row = $sth->fetchrow_array() ) { > print "@row \n"; > } > > # One more thing: we need to disconnect from the database server > # when we're done. > > $dbh->disconnect; > > > -- To unsubscribe, e-mail: beginners-unsubscribe@perl.org > For additional commands, e-mail: beginners-help@perl.org >Thread Previous