I'm struggling to get my Oracle application working. I'm using the Oracle 188.8.131.52.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)
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) ) )
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.