djibel has asked for the wisdom of the Perl Monks concerning the following question:
But, if I want to use this script with CGI, It do not work.#!C:/perl/bin/perl.exe use warnings; use strict; use DBI; my $dbh = DBI->connect('DBI:ODBC:DSN=MY DATABASE', 'login', '' ) or die "Can't connect to database\n$DBI::errstr"; # My code
I have this message : Can't connect to database, Microsoft ODBC Driver Manager Data source name not found and no default driver specified (SQL-IM002) Why connection work without CGI and failed with CGI ? Best Regards,#!C:/perl/bin/perl.exe use warnings; use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); use DBI; my $cgi = new CGI; print $cgi->header(); print $cgi->start_html(); my $dbh = DBI->connect('DBI:ODBC:DSN=MY DATABASE', 'login', '' ) or die "Can't connect to database\n$DBI::errstr"; # My code print $cgi->end_html();
|
|---|