I have this perl script:
#!/usr/bin/perl
print “Content-type: text/html\n\n”;
use Win32::ODBC;
$db1 = new Win32::ODBC(“DATABASE”);
$db1->Sql(“SELECT * FROM Contact”);
while($db1->FetchRow()){
%F1=$db1->DataHash();
print “$F1{CompanyName}
“;
}
$db1->Close();
## END ##
But when i execute this, the page does not display anything. The MS Access *MDB file is located in the db folder where it should be. i’m not sure how to setup an ODBC DSN, because there is no option for that in the control panel. I browsed through their help manual and FAQ file but i could not find a solution, except to put my MS Access files in the db folder.
Win32::ODBC may not be supported on 1and1. Is there an alternative to get my script to work?
My Hosting plan is MS Beginner Package, which supports MS Access and Perl.
I have been emailing their support for almost a week now but i’m not getting a response at all.
Thank you so much for your reply. I tried your advice and this is the code that i have now. I uploaded but still nothing..
#!/usr/bin/perl -w
print “Content-type: text/html\n\n”;
use strict;
use warnings;
use CGI;
use Win32::ODBC;
my $db1 = new Win32::ODBC(“JCSIA”);
# the script stops here
$db1->Sql(“SELECT * FROM Contact”) or die “Cannot connect: “.my $DBI:errstr;
while($db1->FetchRow()){
my %F1=$db1->DataHash();
print “$F1{CompanyName}
“;
}
########################## END
The code stops when connect to ODBC, so i guess this is not supported?
I tried this code and uploaded my database on the same folder, but still not working..
#!/usr/bin/perl -w
print “Content-type: text/html\n\n”;
use strict;
use warnings;
use CGI;
use DBI;
my $DSN = ‘driver=Microsoft Access Driver (*.mdb);dbq=JCSIA.mdb’;
my $dbh = DBI->connect(“dbi:ADO:$DSN”, ”,”)
or die “$DBI::errstr\n”;
What is wrong with my script? I hope you can help me.
use strict;
use warnings;
use CGI;
Check the return value of all (external) function calls.
Fix those items and then come back for more targeted help.