utPLSQL / utPLSQL-cli

Command line client for invoking utPLSQL
Apache License 2.0
40 stars 15 forks source link

utPLSSQL-cli doesn't find tnsnames.ora #163

Open maxbernhardt opened 5 years ago

maxbernhardt commented 5 years ago

Just like described in #88, if the tnsnames.ora file is not located in ORACLE_HOME/network/admin it is not found, which will result in the error described in #88.

If the Oracle environment variable is TNS_ADMIN is set to any path like /home/ccuser/oracle and the normal network config files (sqlnet.ora, ldap.ora, tnsnames.ora) are placed in that directory, Oracle tools like sqlplus and tnsping will work just fine. But utPLSQL-cli doesn't seem to check the TNS_ADMIN setting. Instead I receive this error: ccuser@adeagibx:~/utPLSQL-cli/utPLSQL-cli/bin$ utplsql reporters ****/****@ddopmdb jdbc:oracle:oci8:****/****@ddopmdb: oracle.jdbc.driver.T2CConnection.t2cSetSessionTimeZone(JLjava/lang/String;)I jdbc:oracle:thin:****/****@ddopmdb: could not resolve the connect identifier "ddopmdb" Could not establish connection to database. Reason: could not resolve the connect identifier "ddopmdb" While at the same time e.g. tnsping works fine: ccuser@adeagibx:~/utPLSQL-cli/utPLSQL-cli/bin$ tnsping ddopmdb

TNS Ping Utility for Linux: Version 11.1.0.7.0 - Production on 05-AUG-2019 16:35:41

Copyright (c) 1997, 2008, Oracle. All rights reserved.

Used parameter files: /opt/SP/cmi/etc/oracle/sqlnet.ora

Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION= (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))) (CONNECT_DATA=(SID=DDOPMDB))) OK (20 msec)

The relevant environment variables look like this:

ccuser@adeagibx:/home/ccuser/utPLSQL-cli/utPLSQL-cli/bin$ env | grep ORACLE ORACLE_HOME=/opt/oracle/product/111_cl_64/cl ccuser@adeagibx:/home/ccuser/utPLSQL-cli/utPLSQL-cli/bin$ env | grep TNS TNS_ADMIN=/opt/SP/cmi/etc/oracle

They show, that the *.ora files are located outside of the ORACLE_HOME. This is necessary in our environments, because the base Oracle installation is provided by a different team and we can't just place / update the tnsnames.ora inside ORACLE_HOME.

Can you please enable the use of TNS_ADMIN in the search for tnsnames.ora file if it is set.

pesse commented 5 years ago

Thank you for reporting this and for your patience. It looks like we might already have a solution for this but can't include it so far as to not lose java 9-12 compatibility. I'm on vacation at the moment but will have a closer look once I'm back.