LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-19-2003, 12:09 PM   #1
krzykard
LQ Newbie
 
Registered: Oct 2003
Posts: 7

Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Perl DBI question GoTrolling Linux - Newbie 1 03-21-2007 04:31 AM
Mysql reading via Perl DBI ivanatora Programming 2 03-21-2007 04:03 AM
Perl - DBI PG Installation Problems TheMeteorPolice Linux - Software 2 11-23-2005 10:53 AM
perl | DBI->connect | RHEL AS 3 kaN5300 Linux - Enterprise 6 09-14-2004 08:15 AM
perl DBI prepare question mrtwice Programming 1 10-30-2003 02:12 PM


All times are GMT -5. The time now is 11:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration