TNS_ADMIN Environment not recognized

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
keckhard
Posts: 12
Joined: Fri 08 Apr 2005 09:18

TNS_ADMIN Environment not recognized

Post by keckhard » Tue 24 Jun 2008 06:46

hello,
We tested Odac 6.25 in combination with oracle instant client 10.2.0.4. When we used a own tnsnames.ora in the instant client directory and setup an environment variable TNS_ADMIN which point's to this directory sqlplus and other oracle tools seem to work. Odac also work if there is only the instant client on the workstation. But if there is also installed a fat client (registry settings for it), there is always used the tnsnames.ora out of this directory.
Do we miss some odac settings?
How possible to use our own tnsnames.ora instead of an already installed one.
thx and br, klaus.

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Tue 24 Jun 2008 11:27

Please check whether you have the tnsnames.ora file in the folder to which points the TNS_ADMIN variable.

keckhard
Posts: 12
Joined: Fri 08 Apr 2005 09:18

Post by keckhard » Wed 25 Jun 2008 07:08

hi,
TNS_ADMIN is set and tnsnames.ora is in the directory TNS_ADMIN points to.

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Thu 26 Jun 2008 13:34

No, ODAC always tries to get the TNS_ADMIN environment variable and use its value. Please contact us by e-mail at odac*devart*com. We will send you a test sample to detect why ODAC does not use TNS_ADMIN.

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Post by jfudickar » Fri 27 Jun 2008 06:44

Woudn't it make sence to include this test program into the default distribution.

It could happen more often that a customer can't get a connection, and then such a program would be helpfull.

Greetings
Jens

keckhard
Posts: 12
Joined: Fri 08 Apr 2005 09:18

Post by keckhard » Tue 09 Sep 2008 10:02

hi challanger,
we tested your exe and the outcome is, that your exe recognises the tns_admin variable we set before in a bat-file. when we use the same bat-file and just replace the project1.exe with our exe, the connect still fails.

- we use oracle instant client for our application to be independent from unpredictable registry settings
- the connect fails (with unable to resolve service name) on clients with an additionaly installed non instant-oracle client (but your project1.exe recognises the correct tns_admin variable)
- we use TOraSession with the default settings and don't use direct connection
- we set the connectstring at application start (value adjusted in an ini-file)
- our start script:
set TNS_ADMIN=%PIT_BG_BDE_PATH%\OraClient\tns_admin
set ORACLE_HOME=%PIT_BG_BDE_PATH%\OraClient
set PATH=%PIT_BG_BDE_PATH%\OraClient
cd %PIT_BG_BDE_PATH%\Client
start /D%PIT_BG_BDE_PATH% %PIT_BG_BDE_PATH%\client\bde.exe

it seems that for some reason(s) the registry settings are used instead of the environment variables.

are there some special settings of the TOraSession object we have overseen till now?

thx and best regards, klaus eckhardt.

keckhard
Posts: 12
Joined: Fri 08 Apr 2005 09:18

Post by keckhard » Mon 15 Sep 2008 06:57

hi,
i know i didn't reply the outcome of running your test-project for a long time (holidays and after that lots of other things to do), but i really need a solution for the problem with the ORACLE_HOME and TNS_ADMIN resolution.
thx and best regards, klaus.

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

Post by Plash » Tue 16 Sep 2008 08:38

When several clients are installed, ODAC requeres the correct path to oci.dll. This path cannot be received from the TNS_ADMIN or ORACLE_HOME environment variables.

The current version of ODAC uses only registry to select the default Oracle home. To make ODAC use instant client you should add a value like the following

OCIDLL=C:\InstantClient\oci.dll

to the HKEY_LOCAL_MACHINE\Software\Oracle.

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Post by jfudickar » Tue 16 Sep 2008 09:02

What about adding an option to change this at runtime maybe via a commandline parameter.

Greetings
Jens

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

Post by Plash » Wed 17 Sep 2008 07:22

The OraCall unit has the OCIDLL global variable. You can set this variable in your application before you open the first connection. In this case the value in the registry is not required.

keckhard
Posts: 12
Joined: Fri 08 Apr 2005 09:18

Post by keckhard » Wed 17 Sep 2008 07:24

hi plash,
thx for your answer. this are really bad news. we currently run applications which are requiring different versions of the oracle client. the oldest version of oracle client we are using is 8.0.6 (for a oracle forms application). we have had many problems in the past with multiple oracle homes (clients) on the windows workstations of our users. and so we are quite sure, that if we set this registry key, we are running into big troubles with already existing applications. for our new application the idea is to rollout it with the instant client and get all settings via environment variables. could you please change the behaviour of odac to primary get oracle setting from the environment and if the environment is not set get the oracle setting from the registry?
br, klaus.

keckhard
Posts: 12
Joined: Fri 08 Apr 2005 09:18

Post by keckhard » Wed 17 Sep 2008 08:16

hi,
you made my day. by setting the ocidll variable and using the new oracle naming method (so we don't need the TNS_ADMIN) we can now rollout our application without any changes of the registry.
thx and br, klaus.

Post Reply