This one is not an issue but I just wonder how Xojo OraclePlugin works.
With below code(Windows), there is no problem to connect to Oracle.
32bit Oracle Client(not Instant Client) is installed and PATH(oracle_install/bin) is set.
mDb(mDBCount).DatabaseName = tns 'Oracle tns alias
mDb(mDBCount).UserName = user
mDb(mDBCount).Password = passwd
mDb(mDBCount).Debug = 1
I just pass a ‘tns alias’ after parsing a tnsnames.ora file and connect to Oracle with mDb(mDBCount).Connect.
The thing what I want to know is:
How can Xojo OraclePlugin find the tnsnames.ora file? There is no ORACLE_HOME/TNS_ADMIN environment variable in Windows system.
It picks ORACLE_HOME location by checking PATH(oracle_install/bin) environment variable?
The reason why I am looking for the way how xojo does is to find a flexible solution in case there is not enough environment variable and allow user to pick the location.
I use this:
#if TargetMacOS
System.EnvironmentVariable(“ORACLE_HOME”) = PATH
System.EnvironmentVariable(“DYLD_LIBRARY_PATH”) = PATH
System.EnvironmentVariable(“TNS_ADMIN”) = PATH
#endif
where PATH is the NativePath to the folder.
Yes, I also think above environment variables should be set for connection but I wonder how Xojo OraclePlugin can find the tnsnames.ora file even though there is no TNS_ADMIN / ORACLE_HOME variables in my machine. There is only PATH env and it includes the path pointing the real oci.dll file.
Thank you.
Hello
I have all the ORACLE Stuff in one Folder
tnsnames.ora is included.
I dublicated libclntsh.dylib.10.1 and named it libclntsh.dylib
I dublicated libocci.dylib.10.1 and named it libocci.dylib
All three Environment Variables point to this Folder(ORACLE_10)
ORACLE_10
BASIC_README
classes12.jar
genezi
libclntsh.dylib
libclntsh.dylib.10.1
libnnz10.dylib
libocci.dylib
libocci.dylib.10.1
libociei.dylib
libocijdbc10.dylib
libocijdbc10.jnilib
ojdbc14.jar
tnsnames.ora
Thanks Stefan.
I got the idea from your advice. I realized that I just need to put the required files in the same directory, and should define ORACLE_HOME/TNS_ADMIN/PATH environment variables, actually pointing the same directory.
With that idea, I believe that we can bundle the lightest Oracle client with Application.
Thank you so much again.