List Info

Thread: Problem connecting to orcl with Perl DBD:Oracle




Problem connecting to orcl with Perl DBD:Oracle
user name
2007-08-13 09:58:39
Hi all,
I';m new to perl and oracle.
I have Oracle 10g R2 installed (not XE) on Win XP. I also installed Perl 5.6.1 from AS. Then downloaded DBI and DBD:Oracle and installed them using PPM. Now, I want to test dbd:oracle. I used to following (that I got from some source online):

$ORACLE_SID = "orcl";
$ORACLE_USERID = "system";
$ORACLE_PASSWORD = "...."; (the actual password will be here)

$ENV{'ORACLE_SID'} = "$ORACLE_SID";
$ENV{'ORACLE_HOME'} = "c:\oracle";
....
....
....
local ($oracle_sid, $username, $password) = _;
local ($temp_dbh);
local($tempID, $tempPassword, $tempKey);

print " (*) Attempting Oracle Login ...n";


unless ( $temp_dbh = DBI->connect(";dbi:Oracle:$oracle_sid", "$username", $password, {AutoCommit => 0}) ) {
&programError("Oracle Login Failed as $username", "", "$DBI::errstr", "dba-mail", "dba-pager");
exit;
}

print " OKnn";

The output I got is:
Oracle login failed
ORA-01017: invalid username/password; logon denied <DBD: login failed>
The system cannot find the path specified.
The system cannot find the path specified.

Please note that I can use the same username and password to log into Oracle using SQL*Plus and SQL*Loader.

First when I got this error there was no Oracle_HOME as an environment variable. I added that to C:Oracle and rebooted the system. Also, the Perl that came with Oracle 10g R2 was 5.8.3. So, I renamed that folder (in Oracle home) from perl to perl1. After doing these changes too I got the same error.
Can somebody please throw some light on this and tell me what I have to do ?

Thanks a lot



RE: Problem connecting to orcl with Perl DBD:Oracle
country flaguser name
United Kingdom
2007-08-13 10:51:45
From: activeperl-bounceslistserv.ActiveState.com
[mailto:activeperl-bounceslistserv.ActiveState.com]
On Behalf Of
Sandeep Mudigonda
Sent: 13 August 2007 15:59
To: activeperllistserv.ActiveState.com
Subject: Problem connecting to orcl with Perl DBD:Oracle

> Hi all,
> I'm new to perl and oracle.
> I have Oracle 10g R2 installed (not XE) on Win XP. I
also installed
Perl 5.6.1 from AS. Then downloaded DBI and > DBD:Oracle
and installed
them using PPM. Now, I want to test dbd:oracle. I used to
following
(that I got from 
> some source online):

It might have been better to install the latest version,
rather than
5.6.1, unless you have a good reason to install something
that old.

> 
> $ORACLE_SID = "orcl";
> $ORACLE_USERID = "system";
> $ORACLE_PASSWORD = "...."; (the actual
password will be here)
> 
> $ENV{'ORACLE_SID'} = "$ORACLE_SID";
> $ENV{'ORACLE_HOME'} = "c:\oracle";
> ....
> ....
> ....
> local ($oracle_sid, $username, $password) = _;
> local ($temp_dbh); 
> local($tempID, $tempPassword, $tempKey);
> 
> print " (*) Attempting Oracle Login ...n";
> 
> 
> unless ( $temp_dbh =
DBI->connect("dbi:Oracle:$oracle_sid",
"$username", $password, {AutoCommit => 0}) ) {

> &programError("Oracle Login Failed as
$username", "", "$DBI::errstr",
"dba-mail", "dba-pager");
> exit;
> }
> 
> print " OKnn";

The above code seems rather confused. If this is copied from
"some
source online", then perhaps you could say where that
was, so that I
could recommend that people avoid it.

> 
> The output I got is:
> Oracle login failed
> ORA-01017: invalid username/password; logon denied
<DBD: login failed>
> The system cannot find the path specified.
> The system cannot find the path specified.
> 
> Please note that I can use the same username and
password to log into
Oracle using SQL*Plus and SQL*Loader.
> 
> First when I got this error there was no Oracle_HOME as
an environment
variable. I added that to C:Oracle and > rebooted the
system. Also, the
Perl that came with Oracle 10g R2 was 5.8.3. So, I renamed
that folder
(in 
> Oracle home) from perl to perl1. After doing these
changes too I got
the same error. 
> Can somebody please throw some light on this and tell
me what I have
to do ?

You shouldn't need to rename the perl that comes with
Oracle, as there
shouldn't be any conflicts. If anything, it might be better
to use that
Perl, if it has all of the other modules that you need, as
it is a later
version than the one you are using.

Try the following, after setting the ORACLE_* environment
variables, or
initialising the Perl variables another way if you prefer.

-----------------------------------------------
use strict;
use warnings;

use DBI;

my $user = $ENV;
my $pass = $ENV;
my $sid = $ENV;

print "Attempting connection: user='$user'
password='$pass'
sid='$sid'n"; 
my $dbh = DBI->connect("dbi:Oracle:$sid",
$user, $pass)
    or die "Failed to connect: $DBI::errstrn";
print "Connected OKn";
------------------------------------------------

I strongly suggest reading the documentation that comes with
Activestate
Perl, particularly for the DBI module.

HTH

-- 
Brian Raven

=========================================
Atos Euronext Market Solutions Disclaimer
=========================================

The information contained in this e-mail is confidential and
solely for the intended addressee(s). Unauthorised
reproduction, disclosure, modification, and/or distribution
of this email may be unlawful.
If you have received this email in error, please notify the
sender immediately and delete it from your system. The views
expressed in this message do not necessarily reflect those
of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in
England & Wales with registration no. 3962327. 
Registered office address at 25 Bank Street bond E14 5NQ
United Kingdom. 
Atos Euronext Market Solutions SAS - Registered in France
with registration no. 425 100 294.  Registered office
address at 6/8 Boulevard Haussmann 75009 Paris France.

L'information contenue dans cet e-mail est confidentielle et
uniquement destinee a la (aux) personnes a laquelle
(auxquelle(s)) elle est adressee. Toute copie, publication
ou diffusion de cet email est interdite. Si cet e-mail vous
parvient par erreur, nous vous prions de bien vouloir
prevenir l'expediteur immediatement et d'effacer le e-mail
et annexes jointes de votre systeme. Le contenu de ce
message electronique ne represente pas necessairement la
position ou le point de vue d'Atos Euronext Market
Solutions.
Atos Euronext Market Solutions Limited Société de droit
anglais, enregistrée au Royaume Uni sous le numéro 3962327,
dont le siège social se situe 25 Bank Street E14 5NQ Londres
Royaume Uni.

Atos Euronext Market Solutions SAS, société par actions
simplifiée, enregistré au registre dui commerce et des
sociétés sous le numéro 425 100 294 RCS Paris et dont le
siège social se situe 6/8 Boulevard Haussmann 75009 Paris
France.
=========================================

_______________________________________________
ActivePerl mailing list
ActivePerllistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )