Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    1

    Unanswered: Problem in accessing Database through PERL

    Hi
    I am new to PERL.I have started writing a few programs but when i tried to connect to the database using PERL using the below code
    #!/usr/local/bin/perl
    use DBI
    my $dbh = DBI->connect("dbi:Oracle:BAUp01","pan","panbau")||
    die "can't connect to the database $DBI::errstr\n"
    I got the following error

    Can't locate DBI.pm in @INC (@INC contains: /usr/local/lib/perl5/5.8.0/sun4-sola
    ris /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl .) at dbase
    .pl line 3.
    BEGIN failed--compilation aborted at dbase.pl line 4.

    PLease let me know what is the solution

    Other info
    perl -v

    This is perl, v5.8.0 built for sun4-solaris

    Copyright 1987-2002, 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.com/, the Perl Home Page.
    OS_NAME=SunOS
    OS_VERSION=5.6
    $ version
    Machine hardware: sun4u
    OS version: 5.6
    Processor type: sparc
    Hardware: SUNW,Ultra-4

    The following components are installed on your system:


    Sun WorkShop Professional C 5.0
    Sun WorkShop Compiler C 5.0
    Sun WorkShop IPE 5.0
    Sun WorkShop Dbx 5.0
    Sun WorkShop Performance Analyzer 5.0
    XEmacs 20.4 Source Distribution

    Sun WorkShop FileMerge 3.1


    Please give me a solution
    Thanks
    Poonam Sachdevaundefinedundefined

  2. #2
    Join Date
    Jan 2006
    Posts
    32
    You need to download the DBI module. Run cpan on your machine and tell it to install DBI.



    .

  3. #3
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    167
    Just installing DBI is not enough, you will also need the driver for Oracle which is DBD::Oracle

    perl -MCPAN -e 'install DBI'
    perl -MCPAN -e 'install DBD::Oracle'
    board.perl-community.de - The German Perl-Community

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •