Solved

Connecting to oracle database

Posted on 2006-06-28
5
1,200 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now