DBD Oracle connection problem

------_=_NextPart_001_01C74703.1C78B1CD
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

I am having a problem establishing a connection with my database.



The following connection specification in my program



$dbh =3D DBI->connect("DBI:Oracle:D102L",'scott/tiger','');



Is giving me the error:



DBI connect('D102L','scott/tiger',...) failed: ORA-12154: TNS:could not
resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at
../test.pl line 17



When I have my environment variable ORACLE_SID set to 'D102L' I can
establish the connection without specifying the database name:



$dbh =3D DBI->connect("DBI:Oracle:",'scott/tiger','');
(works fine)



I did get the following warnings during the DBD compilation, the problem
may be related to those:



dbdimp.c: In function `ora_db_login6':

dbdimp.c:385: warning: cast to pointer from integer of different size

dbdimp.c:399: warning: cast to pointer from integer of different size

dbdimp.c:409: warning: cast to pointer from integer of different size

dbdimp.c:413: warning: cast to pointer from integer of different size

dbdimp.c: In function `dbd_rebind_ph_char':

dbdimp.c:1169: warning: cast from pointer to integer of different size





sqlplus works without any problems.





The environment is Solaris 10 x86 64 bit. Oracle version is 10.2 64 bit
and I am running the perl program on the database server.



Any ideas?


------_=_NextPart_001_01C74703.1C78B1CD--
TMaragakis [ Fr, 02 Februar 2007 20:50 ] [ ID #1617089 ]

Re: DBD Oracle connection problem

most likly you have no 'scott/tiger' user on you db

try this

$dbh = DBI->connect(DBI:Oracle,a_db_user." [at] ".a_db_name,a_db_passwor d, {
AutoCommit => 0,RaiseError=>1,PrintError=>1 } ) or die " $DBI::errstr\n";

----- Original Message -----
From: "Terry Maragakis" <TMaragakis [at] affinitymobile.com>
To: <dbi-users [at] perl.org>
Sent: Friday, February 02, 2007 2:50 PM
Subject: DBD Oracle connection problem


I am having a problem establishing a connection with my database.



The following connection specification in my program



$dbh = DBI->connect("DBI:Oracle:D102L",'scott/tiger','');



Is giving me the error:



DBI connect('D102L','scott/tiger',...) failed: ORA-12154: TNS:could not
resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at
../test.pl line 17



When I have my environment variable ORACLE_SID set to 'D102L' I can
establish the connection without specifying the database name:



$dbh = DBI->connect("DBI:Oracle:",'scott/tiger','');
(works fine)



I did get the following warnings during the DBD compilation, the problem
may be related to those:



dbdimp.c: In function `ora_db_login6':

dbdimp.c:385: warning: cast to pointer from integer of different size

dbdimp.c:399: warning: cast to pointer from integer of different size

dbdimp.c:409: warning: cast to pointer from integer of different size

dbdimp.c:413: warning: cast to pointer from integer of different size

dbdimp.c: In function `dbd_rebind_ph_char':

dbdimp.c:1169: warning: cast from pointer to integer of different size





sqlplus works without any problems.





The environment is Solaris 10 x86 64 bit. Oracle version is 10.2 64 bit
and I am running the perl program on the database server.



Any ideas?
scoles [ Fr, 02 Februar 2007 20:58 ] [ ID #1617090 ]

RE: DBD Oracle connection problem

Terry,

I'm a little confused. The error you are getting clearly indicates to
me you do not have a TNS entry in tnsnames.ora for that ORACLE_SID.
From the error docs:

$ oerr ora 12154
12154, 00000, "TNS:could not resolve service name"
// *Cause: The service name specified is not defined correctly in the
// TNSNAMES.ORA file.
// *Action: Make the following checks and correct the error:
// - Verify that a TNSNAMES.ORA file exists and is in the
proper
// place and accessible. See the operating system specific
manual
// for details on the required name and location.
// - Check to see that the service name exists in one of the
// TNSNAMES.ORA files and add it if necessary.
// - Make sure there are no syntax errors anywhere in the
file.
// Particularly look for unmatched parentheses or stray
characters.
// Any error in a TNSNAMES.ORA file makes it unusable. See
// Chapter 4 in the SQL*Net V2 Administrator's Guide. If
// possible, regenerate the configuration files using the
Oracle
// Network Manager.

So, from the machine you are trying to run the Perl program from, can
you:

1. tnsping D102L
2. sqlplus scott/tiger [at] D102L

What other environment variables might you have set (i.e. TWO_TASK)?

--
Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: Terry Maragakis [mailto:TMaragakis [at] affinitymobile.com]
Sent: Friday, February 02, 2007 12:50 PM
To: dbi-users [at] perl.org
Subject: DBD Oracle connection problem

I am having a problem establishing a connection with my database.



The following connection specification in my program



$dbh =3D DBI->connect("DBI:Oracle:D102L",'scott/tiger','');



Is giving me the error:



DBI connect('D102L','scott/tiger',...) failed: ORA-12154: TNS:could not
resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at
../test.pl line 17



When I have my environment variable ORACLE_SID set to 'D102L' I can
establish the connection without specifying the database name:



$dbh =3D DBI->connect("DBI:Oracle:",'scott/tiger','');
(works fine)



I did get the following warnings during the DBD compilation, the problem
may be related to those:



dbdimp.c: In function `ora_db_login6':

dbdimp.c:385: warning: cast to pointer from integer of different size

dbdimp.c:399: warning: cast to pointer from integer of different size

dbdimp.c:409: warning: cast to pointer from integer of different size

dbdimp.c:413: warning: cast to pointer from integer of different size

dbdimp.c: In function `dbd_rebind_ph_char':

dbdimp.c:1169: warning: cast from pointer to integer of different size





sqlplus works without any problems.





The environment is Solaris 10 x86 64 bit. Oracle version is 10.2 64 bit
and I am running the perl program on the database server.



Any ideas?


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.
Ron.Reidy [ Fr, 02 Februar 2007 21:00 ] [ ID #1617091 ]

RE: DBD Oracle connection problem

I am confused too.

My tnsnames.ora file is fine. I did try sqlplus and tnsping, they both
work. Also, if I do not specify the database name (ORACLE_SID is set to
'D102L') the database handle can be created without a problem:

$dbh =3D DBI->connect("DBI:Oracle:",'scott/tiger',''); (works fine)

It is when I try to specify the database name as follows:

$dbh =3D DBI->connect("DBI:Oracle:D102L",'scott/tiger','');

that I am getting the error. I am getting an error when I try this as
well:

$dbh =3D DBI->connect("DBI:Oracle:",'scott [at] D102L','tiger');

I did get a warning during compilation (see my original email) that may
be related to the problem.


-----Original Message-----
From: Reidy, Ron [mailto:Ron.Reidy [at] arraybiopharma.com]
Sent: Friday, February 02, 2007 2:01 PM
To: Terry Maragakis; dbi-users [at] perl.org
Subject: RE: DBD Oracle connection problem

Terry,

I'm a little confused. The error you are getting clearly indicates to
me you do not have a TNS entry in tnsnames.ora for that ORACLE_SID.
From the error docs:

$ oerr ora 12154
12154, 00000, "TNS:could not resolve service name"
// *Cause: The service name specified is not defined correctly in the
// TNSNAMES.ORA file.
// *Action: Make the following checks and correct the error:
// - Verify that a TNSNAMES.ORA file exists and is in the
proper
// place and accessible. See the operating system specific
manual
// for details on the required name and location.
// - Check to see that the service name exists in one of the
// TNSNAMES.ORA files and add it if necessary.
// - Make sure there are no syntax errors anywhere in the
file.
// Particularly look for unmatched parentheses or stray
characters.
// Any error in a TNSNAMES.ORA file makes it unusable. See
// Chapter 4 in the SQL*Net V2 Administrator's Guide. If
// possible, regenerate the configuration files using the
Oracle
// Network Manager.

So, from the machine you are trying to run the Perl program from, can
you:

1. tnsping D102L
2. sqlplus scott/tiger [at] D102L

What other environment variables might you have set (i.e. TWO_TASK)?

--
Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: Terry Maragakis [mailto:TMaragakis [at] affinitymobile.com]
Sent: Friday, February 02, 2007 12:50 PM
To: dbi-users [at] perl.org
Subject: DBD Oracle connection problem

I am having a problem establishing a connection with my database.



The following connection specification in my program



$dbh =3D DBI->connect("DBI:Oracle:D102L",'scott/tiger','');



Is giving me the error:



DBI connect('D102L','scott/tiger',...) failed: ORA-12154: TNS:could not
resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at
../test.pl line 17



When I have my environment variable ORACLE_SID set to 'D102L' I can
establish the connection without specifying the database name:



$dbh =3D DBI->connect("DBI:Oracle:",'scott/tiger','');
(works fine)



I did get the following warnings during the DBD compilation, the problem
may be related to those:



dbdimp.c: In function `ora_db_login6':

dbdimp.c:385: warning: cast to pointer from integer of different size

dbdimp.c:399: warning: cast to pointer from integer of different size

dbdimp.c:409: warning: cast to pointer from integer of different size

dbdimp.c:413: warning: cast to pointer from integer of different size

dbdimp.c: In function `dbd_rebind_ph_char':

dbdimp.c:1169: warning: cast from pointer to integer of different size





sqlplus works without any problems.





The environment is Solaris 10 x86 64 bit. Oracle version is 10.2 64 bit
and I am running the perl program on the database server.



Any ideas?


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.
TMaragakis [ Fr, 02 Februar 2007 21:15 ] [ ID #1617092 ]

RE: DBD Oracle connection problem

I saw the warnings, but I don't think they are a problem.

Are you the same user when you execute the Perl program and the sqlplus
command? If not, do you have local tnsnames.ora and/or sqlnet.ora
files?

rr

-----Original Message-----
From: Terry Maragakis [mailto:TMaragakis [at] affinitymobile.com]
Sent: Friday, February 02, 2007 1:16 PM
To: Reidy, Ron; dbi-users [at] perl.org
Subject: RE: DBD Oracle connection problem

I am confused too.

My tnsnames.ora file is fine. I did try sqlplus and tnsping, they both
work. Also, if I do not specify the database name (ORACLE_SID is set to
'D102L') the database handle can be created without a problem:

$dbh =3D DBI->connect("DBI:Oracle:",'scott/tiger',''); (works fine)

It is when I try to specify the database name as follows:

$dbh =3D DBI->connect("DBI:Oracle:D102L",'scott/tiger','');

that I am getting the error. I am getting an error when I try this as
well:

$dbh =3D DBI->connect("DBI:Oracle:",'scott [at] D102L','tiger');

I did get a warning during compilation (see my original email) that may
be related to the problem.


-----Original Message-----
From: Reidy, Ron [mailto:Ron.Reidy [at] arraybiopharma.com]
Sent: Friday, February 02, 2007 2:01 PM
To: Terry Maragakis; dbi-users [at] perl.org
Subject: RE: DBD Oracle connection problem

Terry,

I'm a little confused. The error you are getting clearly indicates to
me you do not have a TNS entry in tnsnames.ora for that ORACLE_SID.
From the error docs:

$ oerr ora 12154
12154, 00000, "TNS:could not resolve service name"
// *Cause: The service name specified is not defined correctly in the
// TNSNAMES.ORA file.
// *Action: Make the following checks and correct the error:
// - Verify that a TNSNAMES.ORA file exists and is in the
proper
// place and accessible. See the operating system specific
manual
// for details on the required name and location.
// - Check to see that the service name exists in one of the
// TNSNAMES.ORA files and add it if necessary.
// - Make sure there are no syntax errors anywhere in the
file.
// Particularly look for unmatched parentheses or stray
characters.
// Any error in a TNSNAMES.ORA file makes it unusable. See
// Chapter 4 in the SQL*Net V2 Administrator's Guide. If
// possible, regenerate the configuration files using the
Oracle
// Network Manager.

So, from the machine you are trying to run the Perl program from, can
you:

1. tnsping D102L
2. sqlplus scott/tiger [at] D102L

What other environment variables might you have set (i.e. TWO_TASK)?

--
Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: Terry Maragakis [mailto:TMaragakis [at] affinitymobile.com]
Sent: Friday, February 02, 2007 12:50 PM
To: dbi-users [at] perl.org
Subject: DBD Oracle connection problem

I am having a problem establishing a connection with my database.



The following connection specification in my program



$dbh =3D DBI->connect("DBI:Oracle:D102L",'scott/tiger','');



Is giving me the error:



DBI connect('D102L','scott/tiger',...) failed: ORA-12154: TNS:could not
resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at
../test.pl line 17



When I have my environment variable ORACLE_SID set to 'D102L' I can
establish the connection without specifying the database name:



$dbh =3D DBI->connect("DBI:Oracle:",'scott/tiger','');
(works fine)



I did get the following warnings during the DBD compilation, the problem
may be related to those:



dbdimp.c: In function `ora_db_login6':

dbdimp.c:385: warning: cast to pointer from integer of different size

dbdimp.c:399: warning: cast to pointer from integer of different size

dbdimp.c:409: warning: cast to pointer from integer of different size

dbdimp.c:413: warning: cast to pointer from integer of different size

dbdimp.c: In function `dbd_rebind_ph_char':

dbdimp.c:1169: warning: cast from pointer to integer of different size





sqlplus works without any problems.





The environment is Solaris 10 x86 64 bit. Oracle version is 10.2 64 bit
and I am running the perl program on the database server.



Any ideas?


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.
Ron.Reidy [ Fr, 02 Februar 2007 22:43 ] [ ID #1617093 ]

RE: DBD Oracle connection problem

Yes, I am the same user in running both sqlplus and the perl program (my
own user ID). I have the same problem with the Oracle user account as
well. The only tnsnames.ora and sqlnet.ora files are in
$ORACLE_HOME/network/admin.

-----Original Message-----
From: Reidy, Ron [mailto:Ron.Reidy [at] arraybiopharma.com]
Sent: Friday, February 02, 2007 3:44 PM
To: Terry Maragakis; dbi-users [at] perl.org
Subject: RE: DBD Oracle connection problem

I saw the warnings, but I don't think they are a problem.

Are you the same user when you execute the Perl program and the sqlplus
command? If not, do you have local tnsnames.ora and/or sqlnet.ora
files?

rr

-----Original Message-----
From: Terry Maragakis [mailto:TMaragakis [at] affinitymobile.com]
Sent: Friday, February 02, 2007 1:16 PM
To: Reidy, Ron; dbi-users [at] perl.org
Subject: RE: DBD Oracle connection problem

I am confused too.

My tnsnames.ora file is fine. I did try sqlplus and tnsping, they both
work. Also, if I do not specify the database name (ORACLE_SID is set to
'D102L') the database handle can be created without a problem:

$dbh =3D DBI->connect("DBI:Oracle:",'scott/tiger',''); (works fine)

It is when I try to specify the database name as follows:

$dbh =3D DBI->connect("DBI:Oracle:D102L",'scott/tiger','');

that I am getting the error. I am getting an error when I try this as
well:

$dbh =3D DBI->connect("DBI:Oracle:",'scott [at] D102L','tiger');

I did get a warning during compilation (see my original email) that may
be related to the problem.


-----Original Message-----
From: Reidy, Ron [mailto:Ron.Reidy [at] arraybiopharma.com]
Sent: Friday, February 02, 2007 2:01 PM
To: Terry Maragakis; dbi-users [at] perl.org
Subject: RE: DBD Oracle connection problem

Terry,

I'm a little confused. The error you are getting clearly indicates to
me you do not have a TNS entry in tnsnames.ora for that ORACLE_SID.
From the error docs:

$ oerr ora 12154
12154, 00000, "TNS:could not resolve service name"
// *Cause: The service name specified is not defined correctly in the
// TNSNAMES.ORA file.
// *Action: Make the following checks and correct the error:
// - Verify that a TNSNAMES.ORA file exists and is in the
proper
// place and accessible. See the operating system specific
manual
// for details on the required name and location.
// - Check to see that the service name exists in one of the
// TNSNAMES.ORA files and add it if necessary.
// - Make sure there are no syntax errors anywhere in the
file.
// Particularly look for unmatched parentheses or stray
characters.
// Any error in a TNSNAMES.ORA file makes it unusable. See
// Chapter 4 in the SQL*Net V2 Administrator's Guide. If
// possible, regenerate the configuration files using the
Oracle
// Network Manager.

So, from the machine you are trying to run the Perl program from, can
you:

1. tnsping D102L
2. sqlplus scott/tiger [at] D102L

What other environment variables might you have set (i.e. TWO_TASK)?

--
Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: Terry Maragakis [mailto:TMaragakis [at] affinitymobile.com]
Sent: Friday, February 02, 2007 12:50 PM
To: dbi-users [at] perl.org
Subject: DBD Oracle connection problem

I am having a problem establishing a connection with my database.



The following connection specification in my program



$dbh =3D DBI->connect("DBI:Oracle:D102L",'scott/tiger','');



Is giving me the error:



DBI connect('D102L','scott/tiger',...) failed: ORA-12154: TNS:could not
resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at
../test.pl line 17



When I have my environment variable ORACLE_SID set to 'D102L' I can
establish the connection without specifying the database name:



$dbh =3D DBI->connect("DBI:Oracle:",'scott/tiger','');
(works fine)



I did get the following warnings during the DBD compilation, the problem
may be related to those:



dbdimp.c: In function `ora_db_login6':

dbdimp.c:385: warning: cast to pointer from integer of different size

dbdimp.c:399: warning: cast to pointer from integer of different size

dbdimp.c:409: warning: cast to pointer from integer of different size

dbdimp.c:413: warning: cast to pointer from integer of different size

dbdimp.c: In function `dbd_rebind_ph_char':

dbdimp.c:1169: warning: cast from pointer to integer of different size





sqlplus works without any problems.





The environment is Solaris 10 x86 64 bit. Oracle version is 10.2 64 bit
and I am running the perl program on the database server.



Any ideas?


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.
TMaragakis [ Fr, 02 Februar 2007 22:52 ] [ ID #1617094 ]

Re: DBD Oracle connection problem

On 02/02/07 19:50, Terry Maragakis wrote:
> I am having a problem establishing a connection with my database.
>
> The following connection specification in my program

> $dbh = DBI->connect("DBI:Oracle:D102L",'scott/tiger','');
>
> Is giving me the error:
>
> DBI connect('D102L','scott/tiger',...) failed: ORA-12154: TNS:could not
> resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at
> ./test.pl line 17

Mentioning 'D102L' in the first argument in DBI->connect is
roughly equivalent to setting the environment variable
TWO_TASK to the same value. This is usually appropriate for
connecting to remote databases.

If you want to connect directly to a database on the local
computer, the simplest way is to use the ORACLE_SID environment
variable. You can set this within the perl program if you
wish. Vis:

$ENV{ORACLE_SID} = 'D102L';

--
Charles Jardine - Computing Service, University of Cambridge
cj10 [at] cam.ac.uk Tel: +44 1223 334506, Fax: +44 1223 334679
cj10 [ Mo, 05 Februar 2007 11:17 ] [ ID #1619706 ]
Perl » perl.dbi.users » DBD Oracle connection problem

Vorheriges Thema: Problem getting Perl and DBI to work in Win32 environment
Nächstes Thema: Help Needed :: urgent