Perl ADODB MS Access and "Provider cannot be found"

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Perl ADODB MS Access and "Provider cannot be found"

Postby Ratty11 » 11. June 2015 22:24

I'm tearing my hair out here. My perl code to connect to an MS Access 2000 database works perfectly when I execute it from a command prompt when logged in as Administrator on Windows Server 2012 64-bit. But when I try and run it in Apache cgi I keep getting the error: Provider cannot be found. It may not be properly installed. Win32::OLE(0.1709) error 0x800a0e7a in METHOD/PROPERTYGET "Open". I'd had this same exact problem using ApacheLounge's Apache and Strawberry perl (both 32-bit) so I deleted them and installed XAMPP since it's preconfigured for PHP and Perl and I figured it's got the whole 32-bit vs 64-bit driver issues sorted out.

So why does it work perfectly from a command prompt and not through cgi? Is it Apache or Perl that's not looking for a 32-bit ODBC driver? I have tried both a DSN-less connection string as well as registering a 32-bit ODBC data source using C:\windows\sysWOW64\odbcad32.exe and get the same results. My simple test script is below but first my system particulars:

XAMPP for Windows v 5.6.8

C:\xampp\apache\bin>.\httpd.exe -V
Server version: Apache/2.4.12 (Win32)
Apache Lounge VC11 Server built: Jan 28 2015 16:48:40
Server's Module Magic Number: 20120211:41
Server loaded: APR 1.5.1, APR-UTIL 1.5.4
Compiled using: APR 1.5.1, APR-UTIL 1.5.4
Architecture: 32-bit
Server MPM: WinNT
threaded: yes (fixed thread count)
forked: no
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/apache"
-D SUEXEC_BIN="/apache/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error.log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"

C:\xampp\perl\bin>C:\xampp\perl\bin\perl -v

This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x86-multi-t
hread

Copyright 1987-2012, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

And now here is my test script that, again, works perfectly from the command prompt:

Code: Select all
#!"C:\xampp\perl\bin\perl.exe"

use Win32::OLE;
use Win32::OLE::Const 'Microsoft ActiveX Data Objects';
use strict 'vars';

my $db = 'C:\xampp\cgi-bin\anthro_pub.mdb';

print "Content-type: text/plain\n\n";

my $conn = Win32::OLE->new("ADODB.Connection");
my $rs   = Win32::OLE->new("ADODB.Recordset");
my $dsn = "PROVIDER=MSDataShape;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=$db;UID=;PWD=;";
$conn->Open($dsn) or print Win32::OLE::LastError();

my $sql = 'SELECT * FROM "Faculty Names"';
$rs->Open ($sql, $conn, 1, 1);

while (!$rs->EOF) {
   my $name   = $rs->Fields("Name")->value;
   print "$name\n";
   $rs->MoveNext;
}


By the way, I've tried a number of different provider strings with no luck, but there might be one that works I haven't stumbled upon yet. I use a lot of data shaping in my programs so typically use MSDataShape but I think other providers may work too.
Ratty11
 
Posts: 2
Joined: 11. June 2015 22:04
Operating System: Windows Server 2012

Re: Perl ADODB MS Access and "Provider cannot be found"

Postby mark.mcdonald » 15. June 2015 14:37

Did you have any issues using xampp (not specified)? Your issues lie with one of apaches products. MS Access stays local to the machine and perl code can find anything local to machine. Apache works well with mysql. Apache is designed for the world wide web. Trying to mix these technologies will create issues as you have seen. I would try posting a thread on here: http://www.apachelounge.com/viewforum.php?f=5 to see if you can get any further help.
mark.mcdonald
 
Posts: 160
Joined: 13. March 2015 15:48
Location: Edmonton
Operating System: Windows Server 2012 R2

Re: Perl ADODB MS Access and "Provider cannot be found"

Postby Ratty11 » 15. June 2015 20:30

Thanks. I will do that.
Ratty11
 
Posts: 2
Joined: 11. June 2015 22:04
Operating System: Windows Server 2012


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 179 guests