try connect with a minimal script, like this (I didn't try it) :

<snip>
#!/usr/bin/perl -w
use strict;
use CGI;
use DBI;

my $dbh;

print "something before connect";
$dbh = DBI->connect("DBI:mysql:$database", "$username", "$password") or die
"Couldn't connect to database: " . $dbh->errstr;
print "something after";
$dbh->disconnect();
</snip>

If it gives you back the prompt, connection should work, or if not, it
should (I hope) give you an error, and with some chance, you should
something significant in this error ! ;-)

> -----Original Message-----
> From: c cw_1 [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, May 18, 2001 3:28 PM
> To:   [EMAIL PROTECTED]
> Subject:      DBI problem
> 
> Hi,
> 
> I tried to connect to the database, when I compiled it, it replied with
> "(offline mode: enter name=value pairs on standard input)" - What is
> this meant?
> 
> Below is my code:
> 
> #!/usr/bin/perl -w
> use strict;
> use CGI;
> use DBI;
> 
> my $dbh;
> my $sth;
> my @row;
> 
> my $form = new CGI;
> 
> 
> print $form->header;
> print "<html><body>";
> print "ready to connect<p>";
> my $database = "loc_data";
> my $username = "mysql";
> my $password = "mysql";
> 
> 
> #open connection to Access database
> $dbh = DBI->connect("DBI:mysql:$database", "$username", "$password")
>             or die "Couldn't connect to database: " . $dbh->errstr;
> 
> # print "connected<p>";
> 
> #construct SQL statement
> ##$sqlstatement = "SELECT * from tld_data";
> 
> # print "selected<p>";
> 
> #prepare and execute SQL statement
> $sth = $dbh->prepare("SELECT * from tld_data") or die "Can't prepare SQL 
> statement: " ;
> 
> # print "prepared<p>";
> 
> $sth->execute || print "Could not execute SQL statement, maybe invalid?";
> 
> #print "<p>ready to output";
> 
> #output database results
>       while (@row=$sth->fetchrow_array)
>        { print "@row\n<br>" }
> 
> 
> #vprint "hello";
> #close datbase
> 
> $dbh->disconnect();
> $sth -> finish;
> print $form->end_html;
> 
> 
> Thanks in advance,
> Connie
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
> 
> 
> ---------------------------------------------------------------------
> 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 <mysql-unsubscribe-##L=##[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 <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to