> Is this problem because of some configuration not done in apache to access
> Mysql or is it some other problem?If we have to access Mysql through html
> page do we have to do any configuration on the Apache configuration files?
> The perl and html codes are as follows:
> PERL CODE:(try.pl)
> ==================
> #! /usr/bin/perl
> print "Content-type:text/plain \n\n";
> $val=$ENV{QUERY_STRING};
> print "Value is : $val";
> use DBI;
> $con=DBI->connect("DBI:mysql:$db") # where $db is the database
> $result=$con->prepare("select * from tab");
> $result->execute;
> print DBI::dump_results($result);
You should try the script as a simple CGI. If it still fails then this is
not a mod-perl issue and should be taken to a different list.
That said, you need to error check your code. After your
$con=DBI->connect(...);
you should add
defined $con or
die "Error connecting to db: $DBI::errstr";
Your logs should then contain the error message of why the connect failed.
I would be willing to bet this is a MySQL config issue. If its not,
please don't post any follow ups to this list.
Hope that helps,
Joshua
Joshua