RE: Problem with connecting to an Oracle database using Perl

From: Ron Reidy (Ron.Reidy_at_arraybiopharma.com)
Date: 01/19/05


Date: Wed, 19 Jan 2005 08:24:46 -0700
To: "Charles Lawrence" <charles.lawrence@swifttel.net>, <dbi-users@perl.org>

Your environment is not correct, specifically ORACLE_HOME and maybe the NLS vars. I would look at the DBD::Oracle docs. They have information on env vars and how to connect.

-----------------
Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: Charles Lawrence [mailto:charles.lawrence@swifttel.net]
Sent: Tuesday, January 18, 2005 12:55 PM
To: dbi-users@perl.org
Subject: Problem with connecting to an Oracle database using Perl

Gentlemen:

 

I have struggled with this problem for a while now with no success at
finding the answer, so I am asking for help from anyone who might know
the solution.

 

I am using Windows XP, ActiveState Perl 5.8.4, Oracle 9.2.0.1.0 client
and server, DBI (1.45) and DBD-Oracle (1.16) installed as ppm packages
from ftp.esoftmatic.com/outgoing/DBI/5.8.4/

 

I do not have a problem connecting to the remote database using the
Oracle Enterprise Manager program from my PC. However, I am getting the
following error when I try to connect to the database from perl:

 

DBI connect('host=10.1.10.61;sid=ssdb','system',...) failed: ERROR
OCIInitialize. Check ORACLE_HOME and NLS settings etc. at
D:\PerlScripts\ora1.

pl line 17

Unable to connect to database: ERROR OCIInitialize. Check ORACLE_HOME
and NLS settings etc.

 

My perl script is:

 

#!/usr/bin/perl

 

use strict;

use DBI;

use DBD::Oracle qw(:ora_session_modes); # ORA_SYSDBA & ORA_SYSOPER
constants

 

my ($dsn,$usr,$pwd);

my ($dbh);

 

$ENV{NLS_LANG} = 'american';

$ENV{ORACLE_HOME} = 'D:\Oracle\ora92';

 

# connect to remote Oracle DB

$dsn='DBI:Oracle:host=10.1.10.61;sid=ssdb';

$usr='system';

$pwd='manager';

$dbh = DBI->connect($dsn,$usr,$pwd) || die "Unable to connect to
database: $DBI::errstr\n";

 

I have used NLS_LANG settings of 'american_america.we8iso8859p1' and
'american_america.utf8' to no avail. I know the ORACLE_HOME to be
correct. I cannot figure out why I am getting the OCIInitialize error.
Any help will be greatly appreciated. Thanks in advance.

 

Charles Lawrence

charles@swifttel.net

 

This electronic message transmission is a PRIVATE communication which contains
information which may be confidential or privileged. The information is intended
to be for the use of the individual or entity named above. If you are not the
intended recipient, please be aware that any disclosure, copying, distribution
or use of the contents of this information is prohibited. Please notify the
sender of the delivery error by replying to this message, or notify us by
telephone (877-633-2436, ext. 0), and then delete it from your system.



Relevant Pages

  • RE: Memory fault(coredump) with two DBD type connections
    ... I get a core dump ... all the libraries are the same threaded model(single threaded perl uses ... I am running Perl 5.8.8 with DBD-Oracle 1.19 compiled against Oracle ... when I try to connect to the same Oracle database AND same DB2 database ...
    (perl.dbi.users)
  • RE: Perl Oracle incompatibility
    ... Moreover i have not done any changes except to upgrade my Oracle ... database and nothing else. ... Subject: Perl Oracle incompatibility ...
    (perl.dbi.users)
  • Re: DBD::Oracle crashes non-deterministic
    ... No, unfortunately it really CRASHES perl, i.e. it dumps core in the oracle ... One difference we have found is that if we are targetting a 9i R2 Database ...
    (perl.dbi.users)
  • Re: SQLPlus with Perl
    ... I've been assigned a project involving SQLplus calls to an Oracle ... database within Perl code. ... now need to perform a select statement to check values in the database. ...
    (comp.lang.perl.misc)
  • Re: What so special about PostgreSQL and other RDBMS?
    ... That's exactly the link the licence agreement for the database points to when it ... comes to what wecan expect for paying support. ... > "Oracle may provide additional releases or versions of its programs ... If the requirements are volatile I'd do a long term contract detailing what ...
    (comp.lang.php)