Solved

Connecting to oracle database

Posted on 2006-06-28
5
1,225 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…

734 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