Make easier to use TNS connections #119
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently if the Java property oracle.net.tns_admin isn't set, the cli will define it as "ORACLE_HOME/network/admin". This is an attempt to make easier to use TNS connections as discussed in #112. I separated my changes in two commits for easier discussion.
The first commit is a very straightforward change: if there's a TNS_ADMIN environment variable set and it's a valid path, use it to set oracle.net.tns_admin.
The second commit adds a bit more complexity. The idea is:
HKEY_LOCAL_MACHINE\SOFTWARE\Oracle
HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\<subkey>\TNS_ADMIN
and use it if it's validHKEY_LOCAL_MACHINE\SOFTWARE\Oracle\<subkey>\ORACLE_HOME
and if "ORACLE_HOME/network/admin" is valid, use itThe code queries the 64-bit view of the Windows registry (
HKEY_LOCAL_MACHINE\SOFTWARE\Oracle
) and the 32-bit view (HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Oracle
).But this second commit also adds a dependency of JNA, therefore two new .jar would need to be distributed with utPLSQL-cli: jna-5.1.0.jar (1.41 MB) and jna-platform-5.1.0.jar (2.4 MB). The JNA library can be distributed under the Apache License too, so it's safe to use.
(It looks like there are a hackish way to access the Windows registry without any extra dependency, but... well... it's too hackish IMHO)