This discussion belongs on the DBI users list (dbi-users@perl.org), so I'm sending this response there instead of to oracle-oci.
On Tuesday 04 January 2005 09:47, Sandeep Warikoo wrote:
I'm trying the access oracle through perl, but am getting the error "ERROR OCIEnvInit".
My perl script is:
------------------------------------------------------------------------- use DBI;
$ENV{ORACLE_HOME}='/data/oracle/product/9.2.0';
my $dbh = DBI->connect("dbi:Oracle:d7_bilab03","hpbi_owner","hpbi") or die "couldn't connect to database: $DBI::errstr\n";
--------------------------------------------------------------------------
Does anyone know how to solve this?
You haven't told us your operating system and its version or your perl, DBI, and DBD::Oracle versions.
Starting with DBI 1.38, you can use
perl -MDBI -e 'DBI->installed_versions'
to get that information (use " instead of ' in MSWin). For earlier versions use something like
perl -v perl -MDBI=99 perl -MDBD::Oracle=99
to see the Perl, DBI, and DBD::Oracle versions.
On 01/04/2005 03:09 AM, Richard Foley said:
You usually need to have quite a few environment variables set before
you can access Oracle, as the error message (OCIEnvInit) roughly indicates. Try reading the docs that came with the DBI (and DBD::Oracle particularly), I believe there are many examples in there.
You are at least short of
ORACLE_SID or TWO_TASK
$ORACLE_SID or $TWO_TASK are ignored if the SID (d7_bilab03) is given
explicitly. $ORACLE_HOME and other environment variables may need to be
set before starting your script. In *NIX running oraenv before starting perl sets the needed environment variables.
Can you connect to that instance using SQL*Plus in the same account as you are running the Perl script?
-- Mac :}) ** I usually forward private questions to the appropriate mail list. ** Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html Give a hobbit a fish and he eats fish for a day. Give a hobbit a ring and he eats fish for an age.