LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Installing Perl DBI/ADO/Win32/OLE (https://www.linuxquestions.org/questions/linux-software-2/installing-perl-dbi-ado-win32-ole-117852/)

krzykard 11-19-2003 12:09 PM

Installing Perl DBI/ADO/Win32/OLE
 
I have Linux 2.4.18-18 and RedHat9. This is a webserver that is currently up and running properly (using Apache).


What I am trying to do is connect to a MS Access database thru Perl CGI script.

After some reading I figured out that I needed DBI. No problem, I got DBI-1.30.tar from the web. The README file says that I have to Build,test and install Perl. I thought I already had it but I figured installing it twice wouldn't make a difference. The README file say to:
perl Makefile.PL
make
make test
make install

I did all this without any errors. It also states I needed driver modules. I went to the web again and found DBD-ADO-2.79.tar. The README file on that didn't really tell me where to put all these files but after trial and error I figured out the belong in the /usr/lib/perl5/5.8.0/DBD folder.

I wrote (actually I copied most of it from a website) a simple script to tell me what modules are installed. It goes as follows:

#####################
#!/usr/bin/perl


print "Content-type:text/html\n\n";
use strict;
use DBI;
my @drivers=DBI->available_drivers;



print "<html><body>\n";
print "Hello World<br>";
print join("\n",@drivers);
print "\n";
print "</body></html>";
#########################

And it works. It spits out:

#############################
Hello World
ADO ExampleP ODBC Proxy
#########################

Cool. That is what it should do. But when I try to connect to a database, I get errors.

OK first the CGI file that I am using. I took this code off a tutorial on the web. It pretty much should add a table to test.mdb which is located in /home/jonathan

####################################
#!/usr/bin/perl


print "Content-type:text/html\n\n";
use POSIX;
use strict;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use DBI;

my @drivers=DBI->available_drivers;


my $DSN='driver=Microsoft Access Driver (*.mdb);dbq=/home/jonathan/test.mdb';
my $dbh=DBI->connect("dbi:ADO:$DSN",'','')
or die "$DBI::errstr\n";

my $sql=<<"EndOfSQL";
CREATE TABLE tblContacts2(
ID COUNTER,
LastName CHAR(40),
Address CHAR(40),
CONSTRAINT ID_PK PRIMARY KEY(ID)
)
EndOfSQL

$dbh->do($sql)
or die "Execution problem: $DBI::errstr";

print "<html><body>\n";
print "Hello World<br>";
print "Table was Created";
print join("\n",@drivers);
print "\n";
print "</body></html>";

$dbh->disconnect;
#################################

Now here is the error I get when I run this:

###############################
install_driver(ADO) failed: Undefined subroutine &Win32::OLE::TypeInfo::VARFLAG_FHIDDEN called at /usr/lib/perl5/5.8.0/DBD/ADO/Const.pm line 14.
Compilation failed in require at /usr/lib/perl5/5.8.0/DBD/ADO/TypeInfo.pm line 7.
BEGIN failed--compilation aborted at /usr/lib/perl5/5.8.0/DBD/ADO/TypeInfo.pm line 7.
Compilation failed in require at /usr/lib/perl5/5.8.0/DBD/ADO.pm line 288.
BEGIN failed--compilation aborted at /usr/lib/perl5/5.8.0/DBD/ADO.pm line 288.
Compilation failed in require at (eval 1) line 3.
#################################

So I guess my question(s) is this:

Did I install DBI and ADO correctly? I suppose that I have to install Win32::OLE as well but I have no idea where to get it or how to install it.

Anything to help would be great.

Thanks,
krzykard


All times are GMT -5. The time now is 12:34 AM.