For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > July 2004 > Help required with DBI









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help required with DBI
Nandkishore.Sagi

2004-07-28, 8:56 pm

Hi All ,

I need some help with DBI. This is the first time I am working
with DBI module and am pretty new to perl too. I am trying to connect to
a database to execute some queries. I had written a code which is shown
below (It is actually a partial code for just connecting to database). I
am getting errors which I have pasted below. I believe that it might be
due to my lacking some modules but I have turned to you gurus to confirm
that and how can I overcome that. Actually this code would be executed
at multiple boxes so installing the absent packages may not be a
feasible solution.

Thanks for any help.

Code
--------

#!/opt/3d/bin/perl

use strict ;
use warnings ;
use DBI ;

my $database_name ;
my $data_source ;
my $dbh ;
my $username ;
my $password ;

## I have got my username and password here ##

$database_name = $ENV{ORACLE_SID} ; #This contains the ORACLE_SID to
which I need to connect

$data_source = "dbi:DriverName:database_name" ;

$dbh = DBI->connect($data_source , $username , $password)
or die $DBI::errstr ;

$dbh->disconnect ;


Errors
---------

install_driver(DriverName) failed: Can't locate DBD/DriverName.pm in
@INC (@INC contains: /opt/3d/dc0579/lib/perl5/5.8.0/aix-thread-
multi /opt/3d/dc0579/lib/perl5/5.8.0 /opt/3d/dc0579/lib/perl5
/opt/3d/dc0579/lib/perl5/site_perl/5.8.0/aix-thread-multi /opt/3d/dc05
79/lib/perl5/site_perl/5.8.0 /opt/3d/dc0579/lib/perl5/site_perl
/opt/3d/lib/perl5/5.8.0/aix-thread-multi /opt/3d/lib/perl5/5.8.0 /op
t/3d/lib/perl5/site_perl/5.8.0/aix-thread-multi
/opt/3d/lib/perl5/site_perl/5.8.0 /opt/3d/lib/perl5/site_perl .) at
(eval 1) line 3.
Perhaps the DBD::DriverName perl module hasn't been fully installed,
or perhaps the capitalisation of 'DriverName' isn't right.
Available drivers: CSV, ExampleP, File, Oracle, Proxy.
at ./sql_exec.pl line 20

Thanks and Regards
Nand Kishore S

Nand Kishore Sagi
ART Support Team
612-304-6917/612-375-2364

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com