When I first put my website on the present system (64 bit, Windows 7 Premium) I used MS Access 2010 as the database to hold my guestbook entries. I received MS Access 2010 for free as a perk for working in MOSTS (Microsoft Online Services Technical Support). When I left MOSTS, MS disabled my ODBC editing abilities from MS Office 2010. I switched to MS Excel 2000, because I have a copy of Office 2000 (never throw out anything), and I was able to both read and write to it via web access.
MS Excel 2000 hasn't been problem free. The first thing I noticed about MS Excel 2000 is how much slower it is to load into a web page then MS Access 2010. I got around this by breaking the guestbook page into tabs; only 100 guests are loaded at a time. I also found that if too many wrote my guestbook at the same time, MS Excel locks up. This last problem is unacceptable, so I decided to go back to MS Access, but MS Access 2000; 32 bit Access.
I access my databases with Perl scripts through an ODBC connection. This means for a 32 bit database, like MS Access 2000, the ODBC connection must be created with C:\Windows\SysWOW64\odbcad32.exe This seemed to work just fine when reading the guestbook.mdb file (the 32 bit MS Access database) but when writing to it, 64 bit Perl gave error 193; an IO error. I put guestbook.mdb on a 32 bit virtual system (virtual Windows XP) , and was able to write to the database from a 32 bit script running on the 32 bit virtual machine, but then my 64 bit system couldn't read it. It looked like I was going to be forced to run 32 bit Perl on my 64 bit machine.
All of these ODBC connections were being made via the Perl module, DBI. More specifically, I was using DBI::ODBC to connect to the mdb database. Then I thought about Win32. The Win32 module is specifically written for 32 bit Windows, and is what I've been using to connect to MS Excel 2000. Why not use Win32::ODBC instead of DBI:ODBC ? Now everything is back on Serval (my 64 bit system) and is running just fine. Here's the code to my Perl script:
#!/usr/bin/perl
use Win32::ODBC;
use warnings;
use strict;
print "Content-type: text/html\n\n";
print "<html>";
print "<head>";
print "<title>Inquiry Database Updated</title>";
print "</head>";
print "<body bgcolor='#CCFFFF'>";
#my $form = "zero&one&two&three&877-327-8033&dave-marshallATSIGNbk.ru";
my $fname = "Dave";
my $comments ="Great site!";
my $mname = "M";
my $lname = "Marshall";
my $resort = "CNC Villas";
my $phone = "8773278033";
my $email = 'dave-marshallATSIGNbk.ru';
my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my @weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
(my $second, my $minute, my $hour, my $dayOfMonth, my $month, my $yearOffset, my $dayOfWeek, my $dayOfYear, my $daylightSavings) = localtime();
my $year = 1900 + $yearOffset;
my $theTime = "$hour$minute$second$dayOfMonth$month$yearOffset$dayOfWeek$dayOfYear$daylightSavings";
# my $ipaddr = "2.2.2.2";
my $ipaddr = $ENV{REMOTE_ADDR};
if ($ipaddr eq '220.161.149.90')
{
print '<p><font face="Times New Roman" size="4" color="#FF3300"><b><span style="letter-spacing: 1pt">You';
print ' have been banned from making entries in this guestbook.';
print '<center><a href="http://community-info.org">My Personal Home Page</a></center>';
print '</p>';
print '</body>';
print '</html>';
exit;
}
my $form;
if ($ENV{'REQUEST_METHOD'} eq "POST")
{
read(STDIN, $form, $ENV{'CONTENT_LENGTH'});
}
else
{
$form = $ENV{'QUERY_STRING'};
}
$form =~ s/@/ATSIGN/g; # @ screws up perl's string parsing
$form =~ tr/+/ /; # the form sends spaces a plus signs, so change them back
($fname, $mname, $comments, $lname, $resort, $phone, $email) = split (/&/, $form);
$fname = substr $fname, 6;
$mname = substr $mname, 6;
$comments = substr $comments, 6;
$lname = substr $lname, 6;
$email = substr $email, 6;
$email =~ s/ATSIGN/@/g;
print '<p>Connecting to database</p>';
my $dbh = new Win32::ODBC('guestbook');
if (defined $dbh)
{
print "Connected to database\n";
}
else
{
print "Failed to connect to database\n";
}
print '<p>Inserting values into database</p>';
$dbh->sql("insert into prospects (fname, mname, lname, resort, phone, email, comments, ipaddr) values('$fname', '$mname', '$lname', '$resort', '$phone', '$email', '$comments','$ipaddr')");
print '<p><font face="Times New Roman" size="4" color="#FF3300"><b><span style="letter-spacing: 1pt">Thank';
print ' you for filling out my guestbook.';
print ' I really appreciate that you took the time to look at my website and then were';
print ' nice enough to let me know what you liked about it and/or what made you decide';
print ' to look at it in the first place.<br /><br />';
print '<center><a href="http://community-info.org">My Personal Home Page</a></center>';
print '</p>';
print '</body>';
print '</html>';