ORA-12154:TNS:could not resolve service name

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
gymwalker
Posts: 9
Joined: Wed 09 May 2007 23:53
Location: San Diego, CA

ORA-12154:TNS:could not resolve service name

Post by gymwalker » Thu 17 May 2007 17:45

I'm still trying to get ODAC working with Delphi 6. I was using the Oracle 8.1 client and was getting a data type not supported error. So on your recomendation, I upgraded to the 9.2 client. I can connect to my database(s) using SQL*Developer...but when I try to connect from within Delphi 6 using your OraSesson component I get the ORA-12154:TNS:could not resolve service name error.

I've made sure the tnsnames.ora file is in the \Oracle\ora92\network\ADMIN directory and that it works fine with SQL*Developer.

I un-installed the Oracle 8.1 client to make sure that your components wouldn't get confused with it on my system...under 8.1 I could access the database but got the data type error...under 9.2 I can't access the database!

What am I missing?

Thanks in advance for all of your help!

Jim Walker
RedEnvelope, Inc.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 18 May 2007 07:34

1. Make sure that path to your application does not contain brackets (this is a bug in the Oracle client).
2. If the TNS name of your server contains a domain name, make sure that the Server property of the TOraSession component contains the name with the domain name.
Also please specify whether a default domain is set in the sqlnet.ora file.

gymwalker
Posts: 9
Joined: Wed 09 May 2007 23:53
Location: San Diego, CA

Solved thanks!

Post by gymwalker » Fri 18 May 2007 16:34

The problem was actually in the order in which Oracle Client was doing its search during name resolution...out of the box 9.2 was configured to search LOCALHOST, ORAHOST then HOSTNAME...I moved the LOCALHOST to the bottom of the list and everything started resolving just fine. I'm not an Oracle wiz...so this doesn't make a lot of sense to me...I was just tinkering to try to get something to work.

Thanks for your help!
Jim

Post Reply