Try adding the hostname of the MySQL to your connect string. my $dth = DBI->connect("DBI:mysql:database=db_name;host=hostname","user","pass");
Greg > -----Original Message----- > From: aman cgiperl [mailto:[EMAIL PROTECTED]] > Sent: Friday, August 30, 2002 10:46 AM > To: [EMAIL PROTECTED] > Subject: database connection problem > > > Hello everyone > I am doing the following > > ----------------------------------------- > 1 #!/usr/bin/perl > 2 > 3 use strict; > 4 use CGI qw(:standard); > 5 use CGI::Carp qw(fatalsToBrowser); > 6 use DBI; > 7 > 8 print header; > 9 print start_html(); > 10 $s = 'aman'; > > 12 my $dth = DBI->connect("DBI:mysql:db_name","user","pass"); > 26 my $sth_check = dth->prepare("SELECT * FROM mytab WHERE s='$s'"); > 28 sth_check->execute; > 41 $dth->disconnect; > > 137 print end_html; > > --------------------------------------- > I am getting the following output. What could be wrong ??? > -------------------------------------- > Content-type: text/html > Software error: > Can't locate object method "prepare" via package "dth" (perhaps > you forgot to load "dth"?) at /home/somesite/cgi-bin/script line 26. > > For help, please send mail to the webmaster > ([EMAIL PROTECTED]), giving this error message and the time > and date of the error. > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]