CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
DBD::ORACLE connectivity problem

 



pra_ml
Novice

Dec 30, 2008, 4:26 AM

Post #1 of 2 (2830 views)
DBD::ORACLE connectivity problem Can't Post

Hi

I am getting below mentioned error while trying to connect DB using a perl script

install_driver(Oracle) failed: Can't locate loadable object for module DBD::Oracle in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at (eval 2) line 3
Compilation failed in require at (eval 2) line 3.
Perhaps a module that DBD::Oracle requires hasn't been fully installed


Code is as follows



#!/usr/local/bin/perl
my $oracle_home = "/x/home/oracle/product/8.1.7";
use Env ( "ORACLE_HOME" );
$ORACLE_HOME = "$oracle_home";
use DBI;
$dbh=DBI->connect('DBI:Oracle:abcde', 'uname', 'passwd') ;



Some one please help me in solving this issue.


FishMonger
Veteran / Moderator

Dec 30, 2008, 6:05 AM

Post #2 of 2 (2827 views)
Re: [pra_ml] DBD::ORACLE connectivity problem [In reply to] Can't Post

You need to install the Oracle database driver module DBD::Oracle.

http://search.cpan.org/~pythian/DBD-Oracle-1.22/Oracle.pm

Your method of assigning the ENV var is wrong.

It's better style and a "Best Practice" to put your use statements, which are loaded at compile time, before any other code. And, every Perl script you write should include the warnings and strict pragmas.


Code
#!/usr/local/bin/perl 

use warnings;
use strict;
use DBI;

$ENV{"ORACLE_HOME"} = "/x/home/oracle/product/8.1.7";
my $dbh = DBI->connect('DBI:Oracle:abcde', 'uname', 'passwd');



(This post was edited by FishMonger on Dec 30, 2008, 6:06 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives