Results 1 to 4 of 4

Thread: DBI and Oracle

  1. #1
    Join Date
    Apr 2003
    Posts
    8

    Unanswered: DBI and Oracle

    I normally use DBI for Sybase and just start to use Oracle.

    I ran into very basic problem and would appreciate any input.

    I can access Oracle via sqlplus. However, my connection to oracle simply failed.

    Thanks!

    Here is my code:

    $| = 1;

    BEGIN {

    $ENV{'ORACLE_BASE'} = "/ora00/app/oracle";
    $ENV{'ORACLE_HOME'} = }
    $ENV{'LD_LIBRARY_PATH'} = "/ora00/app/oracle/product/9.2.0/lib";
    $ENV{'ORACLE_SID'} = "oratest9";
    $ENV{DBI_TRACE}=1;
    $ENV{PERL_DBI_DEBUG}=1;
    }

    use strict;
    use lib "/prod/gnumod/lib/perl5/site_perl";
    use DBI;

    my $login = "dss/abc123 @" . "oratest9";

    my $dbh = DBI->connect("dbi:Oracle:", $login, "" )
    or die "could not connect to 'dssupport' database: $DBI::errstr\n";

    printData();

    $dbh->disconnect();


    sub printData {

    my $sth = $dbh->prepare(qq( SELECT * FROM owner.table)

    or die "could not prepare: " . $dbh->errstr();

    $sth->execute() or die "could not execute " . $dbh->errstr();

    }

    And the error trace:

    dbdev-sun% !perl
    perl testpl
    DBI 1.37-nothread dispatch trace level set to 1
    -> DBI->connect(dbi:Oracle:, , ****)
    -> DBI->install_driver(Oracle) for solaris perl=5.006001 pid=23222 ruid=2693 euid=2693
    install_driver: DBD::Oracle version 1.03 loaded from /prod/perl/5.6.1/lib/site_perl/5.6.1/sun4-solaris/\
    DBD/Oracle.pm
    <- install_driver= DBI::dr=HASH(0x1b6a14)
    <- connect('' '' ...)= undef at DBI.pm line 582
    <- errstr= undef at DBI.pm line 584
    Use of uninitialized value in concatenation (.) or string at /prod/perl/5.6.1/lib/site_perl/5.6.1/sun4-solaris\
    /DBI.pm line 584.
    DBI connect('','',...) failed:
    DBI connect('','',...) failed: at testpl line 26
    error: -1 'ERROR OCIEnvInit'
    <- DESTROY= undef at DBI.pm line 639
    could not connect to 'dssupport' database: ERROR OCIEnvInit
    <- disconnect_all= '' at DBI.pm line 649
    ! <- DESTROY= (not implemented) during global destruction

  2. #2
    Join Date
    Sep 2003
    Posts
    2

    Re: DBI and Oracle

    my $dbh = DBI->connect("dbi:Oracle:", $login, "" )
    or die "could not connect to 'dssupport' database: $DBI::errstr\n";


    DBI connect('','',...) failed: at testpl line 26
    error: -1 'ERROR OCIEnvInit'
    <- DESTROY= undef at DBI.pm line 639
    could not connect to 'dssupport' database: ERROR OCIEnvInit

    PLEASE TELL ME THE SOLUTION FOR ABOVE ERROR. VERY URGENT

  3. #3
    Join Date
    Sep 2003
    Posts
    2
    Hi,

    Did u got solution to the problem.

    I am not able to connect to database from PERL program on onsite server.

    Perl version : 5 (revision 5.0, version 8, subversion 0) on onsite server

    We are doing (su - wics ) & then simply typing "sqlplus /" to connect to sqlplus on onsite server.

    so in perl program we have written....

    $log_in = &ora_login("","","") || die ("login failed : $! $ora_errstr \n ");

    but this gives ERROR OCIEnvInit.

    Please suggest some solution to this.

    Mail to priya_0803@yahoo.com

    Thanks in advance.

  4. #4
    Join Date
    Jan 2004
    Posts
    1
    Hi,

    Has anyone figured this out yet? Can someone post the solution if you have found the answer?

    Thanks!

Posting Permissions

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