List:General Discussion« Previous MessageNext Message »
From:Micheal Mc Evoy Date:July 22 1999 2:28am
Subject:Re: HELP! Client Can't connect
View as plain text  
On Wed, 21 Jul 1999, Chris Lambrou wrote:

>I know I am doing something wrong here, just can't figure it
>out.  I am using the following PERL code to connect to my local
>mysql server:
>print "Content-Type: text/html\n\n";
>use Mysql;
>$dbh = Mysql->Connect('localhost', 'z100' ,'Z100' ,'z100club+'); 
>if (not $dbh)  {
>  print "Could Not connect to database.\n";
>  print "Reason: $Mysql::db_errstr";
>} else {
>  print "Connected";

Well, for starters, I would recommend using DBI.  
If you haven't downloaded the latest, get it from CPAN.
It's Msql-Mysql-modules-1.2201.tar.gz

Try something like this.
#! /usr/bin/perl -wT
use CGI;
use DBI;
use strict;

my $dbname = 'somedb';
my $dbuser = 'someusr';
my $dbpass = 'somepwd';

#--- connect to database
my $dbh = DBI->connect("dbi:mysql:$dbname", $dbuser, $dbpass)
    || die "Couldn't connect to $dbname: $DBI::errstr\n";

my $form     = new CGI;

print $form->header();
print $form->start_html;
print "Connected";
print $form->end_html();


>( The $Mysql::db_errstr string is EMPTY!!! )

It sounds like your connect string failed to read in  the variables.


Micheal Mc Evoy                                    mjmc@stripped

WhitePine Consulting supports the Free Software Foundation and it ideals
by promoting, using and supporting Open Source, GNU and GPL'd Software.

HELP! Client Can't connectChris Lambrou21 Jul
  • Re: HELP! Client Can't connectSasha Pachev21 Jul
  • Re: HELP! Client Can't connectMicheal Mc Evoy22 Jul