will_danger has asked for the wisdom of the Perl Monks concerning the following question:
The error follows:#!C:/strawberry/perl/bin/perl.exe use strict; use DBI; use Text::CSV; use Win32::OLE; my $DBFile = "KosJourney.accdb"; my $DBHandle = DBI->connect("dbi:ADO:Provider=Microsoft.ACE.OLEDB.12.0 +;Data Source=$DBFile;Persist Security Info=False;") or die $DBI::errs +tr; ..... open my $FILEHANDLE,$FilePath or die "Failure opening CSV file for rea +ding: " . $!; while (<$FILEHANDLE>) { chomp; next if /Last Name/; my ($LastName,$FirstName,$GUID) = split (/\t/,$_); $LastName =~ s/"//g; $FirstName =~ s/"//g; $GUID =~ s/"//g; my $FullName = $FirstName . " " . $LastName; my $InsertUserQuery = "INSERT INTO Users (Username,FullName,FirstN +ame,LastName) VALUES (?,?,?,?);"; &Echo("Executing SQL: " . $InsertUserQuery); my $InsertUserResult = $DBHandle->prepare($InsertUserQuery); $InsertUserResult->execute($GUID,$FullName,$FirstName,$LastName); } close $FILEHANDLE;
It is the connection string throwing the exception. I have access 2010 installed. I'm not sure if it is necessary but I have also installed MDAC (http://www.microsoft.com/en-us/download/confirmation.aspx?id=5793) as well as Microsoft Access Database Engine 2010 Redistributable (http://www.microsoft.com/en-us/download/details.aspx?id=13255). The weird thing is, this exact setup is working just fine on other computers (which are identical in configuration and hardware). The .adddb file is sitting next to this script into the same folder, to eliminate path issues. All of the modules noted in the code have been successfully installed via CPAN. I have and still am scouring the web for help on this, so far nothing has been forthcoming. Note that I don't really care how the connection is made, I am using DBI because that is what I am familiar with. I do not have a DSN set up on my local machine but I didn't beleive that to be necessary. Any help anyone can offer will be really appreciated.DBI connect('Provider=Microsoft.ACE.OLEDB.12.0;Data Source=KosJourney. +accdb;Persist Security Info=False;','',...) failed: Can't Open Connec +tion 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=KosJourney.accdb; +Persist Security Info=False;' Package : DBD::ADO::dr Filename : C:/strawberry/perl/vendor/lib/DBD/ADO.pm Line : 158 Last error : -2146824582 OLE exception from "ADODB.Connection": Provider cannot be found. It may not be properly installed. Win32::OLE(0.1709) error 0x800a0e7a in METHOD/PROPERTYGET "Open" at PopulateUsersFromResultCSV.pl line 21 Can't Open Connection 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=K +osJourney.accdb;Persist Security Info=False;'
|
|---|