-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make easier to use TNS connections #119
Conversation
Hi @felipebz , I'd also suggest that we use What do you think? |
I thought about the JNA again. |
@pesse Thanks for the feedback. I'll make some changes. Regarding the hacky solution: it works fine in Java 8, but in Java 11 it causes a But then I thought about all of this again today and what if we don't add this Windows registry lookup and keep it simple, only looking for the TNS_ADMIN env var? |
Hey @felipebz |
I'm sorry for the lack of news, @pesse. I'll work on it. ;-) |
No pressure, just wanted to know :) |
cbb4503
to
3dbe4d5
Compare
The PR would work for Java 8, but it would break compatibility with Java 9+ |
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)