Hi All,

Thanks for all the information.

d7_bilab03 is actually an net alias on a development m/c to database instance on bilab03 (test machine).

Initially, we thought our problem may have been because of up gradation from oracle 8i to oracle 9i (this was on a development machine), but we were not sure whether any up gradation was done on it in past or not.
So we actually installed perl & DB modules on a test machine (bilab03, This machine initially only had database.) and tried the run the same program (with necessary modifications) from there, but the problem persists. It has oracle 9i installed on it, so the problem can't be because of upgrade.


The result of perl -MDBI -e 'DBI->installed_versions' on bilab03 is:
Perl : 5.008005 (PA-RISC1.1-thread-multi)
OS : hpux (11.00)
DBI : 1.43
DBD::mysql : 2.1026
DBD::Sponge : 11.10
DBD::Proxy : install_driver(Proxy) failed: Can't locate RPC/PlClient.pm in @INC
DBD::Pg : 1.13
DBD::Oracle : 1.12
DBD::File : 0.31
DBD::ExampleP : 11.12
DBD::DBM : 0.02


The result of perl -MDBI -e 'DBI->installed_versions' on development m/c is:
Perl : 5.008005 (PA-RISC1.1-thread-multi)
OS : hpux (11.00)
DBI : 1.43
DBD::mysql : 2.1026
DBD::Sponge : 11.10
DBD::Proxy : install_driver(Proxy) failed: Can't locate RPC/PlClient.pm in @INC
DBD::Pg : 1.13
DBD::Oracle : 1.12
DBD::File : 0.31
DBD::ExampleP : 11.12
DBD::DBM : 0.02




Yes, I can connect to database through sqlplus from both the development m/c and bilab03. All the necessary environment variables (ORACLE_HOME, ORACLE_SID, LD_LIBRARY_PATH, etc) are properly set.

Regards,
Sandeep

Michael A Chase tech wrote:
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?

Reply via email to