Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Can someone help me figure out what is the problem with this code? I can't figure out why it won't connect to a database. I've tried to use DBI::ODBC WIN32:OLE and WIN32::ODBC but it doesn't look like my hosting company supports any of them. Here's the code:
use DBI; $fn = $Form{'First Name'}; $ln = $Form{'Last Name'}; $ea = $Form{'Email Address'}; $pn = $Form{'Phone Number'}; $add = $Form{'Address'}; $dor = $Form{'Date Of Request'}; $ds = $Form{'submit date'}; $dbh = (DBI->connect ("DBI:ADO:File Name=$database")); $sql = "INSERT INTO vip (First_Name,Last_Name,Email_Address,Phone_Numb +er,Address,Date_Of_Request,Date_Submit) VALUES ('$fn','$ln','$ea','$p +n','$add','$dor','$ds')"; $dbh->Execute($sql); $dbh->Close();
I get this error when i run this. install_driver(ADO) failed: Can't locate Win32/OLE/Variant.pm in @INC .... Thanks for any help.

Replies are listed 'Best First'.
Re: ADO Problems and Access
by VSarkiss (Monsignor) on Sep 11, 2002 at 21:24 UTC

    It's possible DBD::ADO isn't installed, or isn't installed properly. Try typing from a command line: perl -MDBD::ADO -e 1and see if it's able to find the module.

      If DBD::ADO was missing it would say:
      C:\>perl -MDBD::ADO -e 1 Can't locate DBD/ADO.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/si +te/lib .). BEGIN failed--compilation aborted.

      or this using his code

      C:\>"C:\Documents and Settings\blm\Desktop\testingdbd.pl" install_driver(ADO) failed: Can't locate DBD/ADO.pm in @INC (@INC cont +ains: C:/P erl/lib C:/Perl/site/lib .) at (eval 1) line 3. Perhaps the DBD::ADO perl module hasn't been fully installed, or perhaps the capitalisation of 'ADO' isn't right. Available drivers: ExampleP, Proxy. C:\>
Re: ADO Problems and Access
by blm (Hermit) on Sep 12, 2002 at 02:37 UTC

    It seems to be complaining about not finding Win32::OLE::Variant needed to program COM (OLE) objects under Windows that use variant datatype like ADO . See if it is installed with this:

    perl -MWin32::OLE -MWin32::OLE::Variant -e 1

    If I am wrong no error message will result from the above code.