Set TNS Name admin path while running a component from Java

287 Views Asked by At

Currently I m running a component (IBM WTX tool) from Java using the jars provided by IBM. In the WTX component I am connecting to a oracle database using tns connect identifier. While the running the component independently the tool picks up the tnsnames.ora of the oracle driver installed in my system and it works fine. But when running the same component from Java it could not resolve the tnsname and fails. Do we need to do any additional setup in Java Side?

I tried System.setProperty("oracle.net.tns_admin",""). But It didn't work.

Can anyone help on the issue?

Regards,

1

There are 1 best solutions below

0
pmdba On

TNS_ADMIN must be set in the environment before the Java process is started. I don't think it can be set from within Java - or at least I haven't seen it done successfully before. Typically I have see this set from a shell script that also launches the Java program.