Solved

Connecting to oracle database

Posted on 2006-06-28
5
1,221 Views
Last Modified: 2010-05-18
Hi

I am using rhe current code to connect to an oracle database:

#!/C/perl/bin/

use strict;
use DBI;
my $dbhost = DBI->connect("dbi:Oracle:test.world",'pass','pass') || die "Cant connect to Oracle database $DBI::errstr\n";

I am getting the following error

DBI connect('test.world',test',...) failed: ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at test.pl line 6
Cant connect to Oracle database ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach)

Any ideas what is the problem?
0
Comment
Question by:gghaleb
  • 2
  • 2
5 Comments
 

Author Comment

by:gghaleb
ID: 17004442
Now I get the following error:

DBI connect('test.world','pass',...) failed: ORA-12705: invalid or unknown NLS parameter value specified (DBD ERROR: OCISessionBegin) at test.pl line 6
Cant connect to Oracle database ORA-12705: invalid or unknown NLS parameter value specified (DBD ERROR: OCISessionBegin)

any ideas
0
 
LVL 12

Expert Comment

by:stefan73
ID: 17008414
Hi gghaleb,
That does not look like a specific Perl / DBI problem. Please check if you can connect to your destination using sql*plus:

sqlplus user/pass@instance


Enjoy,

Stefan
0
 
LVL 12

Accepted Solution

by:
stefan73 earned 500 total points
ID: 17008419
gghaleb,


or in your case: sqlplus pass/pass@test.world

You might want to try:

tnsping test.world

Stefan
0
 
LVL 6

Expert Comment

by:tone28
ID: 17010854
You will need the Oracle client and the appropriate TNSNames in your C:\ORAXXX\Network\Tnsnames.txt or whatever.

Does that make sense?
0
 

Author Comment

by:gghaleb
ID: 17027065
Hi All,

I have the database already in tnsnames.ora and I can connect to it using sqlplus.
This was not the problem. The problem was related to an environment variable NLS_LANG. which needed to be set.

This is an Oracle problem rather than a perl problem. Thanks for your help anyway.

Regards

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question