2

I'm struggling to get my Oracle application working. I'm using the Oracle 11.2.0.4.0 instant client with a C++ application that is compiled using Visual Studio 2010. The machine is running Windows Server 2012 R2. The database is running on another machine.

The application is as basic as possible where I set up the environment and try to get the connection.

When trying to run it I'm faced with two different TNS errors:

ORA-12543: TNS:destination host unreachable (when using EZConnect string)

and

ORA-12154: TNS:could not resolve the connect identifier specified (when using the TNS name)

I'm running the application from the instant client directory, with ORACLE_HOME set as the same directory. I also export the directory of the oraocci11 dll files in the PATH variable.

What is strange is that sqlplus can connect without problems using both EZconnect and the TNS name (I have a tnsnames.ora in /network/admin).

What am I doing wrong?

Edit: Here is tnsnames.ora:

G2CLIENT =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.77)(PORT = 1521))
    )
  (CONNECT_DATA =
    (SERVICE_NAME = web)
  )
)

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  (CONNECT_DATA =
    (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

WEB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.77)(PORT = 1521))
  )
  (CONNECT_DATA =
    (SERVICE_NAME = web)
  )
)

and sqlnet.ora:

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, HOSTNAME)
SQLNET.AUTHENTICATION_SERVICES = (NTS)

The call that triggers the error is createConnection on a StatelessConnectionPool object which I have tried calling with different variations:

createStatelessConnectionPool("username","pwd","WEB")
createStatelessConnectionPool("username","pwd","10.0.1.77/WEB")
createStatelessConnectionPool("","","username/pwd@//10.0.1.77/WEB")

All of these seem to throw ORA-12154.

And as I mentioned above, sqlplus works fine.

3
  • 1
    post your tnsname description. Cant say without looking at the description. Otherwise our answers will be just a guesswork.
    – atokpas
    Feb 12, 2016 at 15:56
  • Can you show us your sqlnet.ora and listener status as well? Also show us your connection string and your tnsnames.ora entry. Thank you. Feb 12, 2016 at 21:32
  • I updated the question with the files. The listener works fine, as we have a lot of other OC(C)I apps running against it. They are using a different version though.
    – anders
    Feb 15, 2016 at 9:13

2 Answers 2

0

suppose Orcl service already created but you can't communicate with them then do follow : you need to run your database service like "oracleServiceorcl" as a Administrator so that client server can communicate.

If any doubt then plz put error like ora- Any Digiy

2
  • The first error says in so many words "destination host unreachable". The second - ORA-12154) means the client wasn't even able to determine an address, so the request died before it even attempted to send a request to the host. Therefore, checking oracle services (assuming the db server is even running Windows - we don't know) or the listener is a total waste of time.
    – EdStevens
    Feb 12, 2016 at 22:11
  • The "ORA-12543' means that whatever host you specified in the ezconnect was not reachable. Either you specified the wrong host, or there is a firewall blocking. The "ORA-12154" means that whatever you specified in your connect string was not found in your tnsnames.ora. Since you haven't shown any of it, we can't say what you did wrong. I have a writeup of ORA-12154 at edstevensdba.com/oracle-tns/ora-12154tns-03505
    – EdStevens
    Feb 12, 2016 at 22:16
0

I have figured it out. It seems there was a subtle dependency issue which resulted in a pretty irrelevant ORA message. The O11 instant client is not shipped with VS2010 lib/dll files. You need to download these separately, something I had done long ago and forgot about it. When compiling the app, I linked against the correct lib file but when running against the instant client I used the old oraocci11.dll file.

Thanks a lot for your help guys!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.