DBD Oracle connection problem

DBD Oracle connection problem

am 02.02.2007 20:50:05 von TMaragakis

------_=_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.

=20

The following connection specification in my program

=20

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

=20

Is giving me the error:

=20

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

=20

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

=20

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

=20

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

=20

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

=20

=20

sqlplus works without any problems.

=20

=20

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.

=20

Any ideas?


------_=_NextPart_001_01C74703.1C78B1CD--

Re: DBD Oracle connection problem

am 02.02.2007 20:58:51 von scoles

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

try this

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

----- Original Message -----
From: "Terry Maragakis"
To:
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?

RE: DBD Oracle connection problem

am 02.02.2007 21:00:58 von Ron.Reidy

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@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@affinitymobile.com]=20
Sent: Friday, February 02, 2007 12:50 PM
To: dbi-users@perl.org
Subject: DBD Oracle connection problem

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

=20

The following connection specification in my program

=20

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

=20

Is giving me the error:

=20

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

=20

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

=20

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

=20

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

=20

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

=20

=20

sqlplus works without any problems.

=20

=20

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.

=20

Any ideas?


This electronic message transmission is a PRIVATE communication which =
contains
information which may be confidential or privileged. The information is =
intended=20
to be for the use of the individual or entity named above. If you are =
not the=20
intended recipient, please be aware that any disclosure, copying, =
distribution=20
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.

RE: DBD Oracle connection problem

am 02.02.2007 21:15:53 von TMaragakis

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','');=20

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

$dbh =3D DBI->connect("DBI:Oracle:",'scott@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@arraybiopharma.com]
Sent: Friday, February 02, 2007 2:01 PM
To: Terry Maragakis; dbi-users@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@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@affinitymobile.com]=20
Sent: Friday, February 02, 2007 12:50 PM
To: dbi-users@perl.org
Subject: DBD Oracle connection problem

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

=20

The following connection specification in my program

=20

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

=20

Is giving me the error:

=20

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

=20

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

=20

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

=20

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

=20

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

=20

=20

sqlplus works without any problems.

=20

=20

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.

=20

Any ideas?


This electronic message transmission is a PRIVATE communication which
contains
information which may be confidential or privileged. The information is
intended=20
to be for the use of the individual or entity named above. If you are
not the=20
intended recipient, please be aware that any disclosure, copying,
distribution=20
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.

RE: DBD Oracle connection problem

am 02.02.2007 22:43:51 von Ron.Reidy

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@affinitymobile.com]=20
Sent: Friday, February 02, 2007 1:16 PM
To: Reidy, Ron; dbi-users@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','');=20

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

$dbh =3D DBI->connect("DBI:Oracle:",'scott@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@arraybiopharma.com]
Sent: Friday, February 02, 2007 2:01 PM
To: Terry Maragakis; dbi-users@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@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@affinitymobile.com]=20
Sent: Friday, February 02, 2007 12:50 PM
To: dbi-users@perl.org
Subject: DBD Oracle connection problem

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

=20

The following connection specification in my program

=20

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

=20

Is giving me the error:

=20

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

=20

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

=20

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

=20

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

=20

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

=20

=20

sqlplus works without any problems.

=20

=20

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.

=20

Any ideas?


This electronic message transmission is a PRIVATE communication which
contains
information which may be confidential or privileged. The information is
intended=20
to be for the use of the individual or entity named above. If you are
not the=20
intended recipient, please be aware that any disclosure, copying,
distribution=20
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.

RE: DBD Oracle connection problem

am 02.02.2007 22:52:47 von TMaragakis

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@arraybiopharma.com]=20
Sent: Friday, February 02, 2007 3:44 PM
To: Terry Maragakis; dbi-users@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@affinitymobile.com]=20
Sent: Friday, February 02, 2007 1:16 PM
To: Reidy, Ron; dbi-users@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','');=20

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

$dbh =3D DBI->connect("DBI:Oracle:",'scott@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@arraybiopharma.com]
Sent: Friday, February 02, 2007 2:01 PM
To: Terry Maragakis; dbi-users@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@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@affinitymobile.com]=20
Sent: Friday, February 02, 2007 12:50 PM
To: dbi-users@perl.org
Subject: DBD Oracle connection problem

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

=20

The following connection specification in my program

=20

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

=20

Is giving me the error:

=20

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

=20

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

=20

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

=20

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

=20

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

=20

=20

sqlplus works without any problems.

=20

=20

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.

=20

Any ideas?


This electronic message transmission is a PRIVATE communication which
contains
information which may be confidential or privileged. The information is
intended=20
to be for the use of the individual or entity named above. If you are
not the=20
intended recipient, please be aware that any disclosure, copying,
distribution=20
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.

Re: DBD Oracle connection problem

am 05.02.2007 11:17:02 von cj10

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@cam.ac.uk Tel: +44 1223 334506, Fax: +44 1223 334679