I've been trying to switch from the Oracle OCI driver to the thin driver, I got the thin driver to pickup my tnsnames.ora
by adding -Doracle.net.tns_admin=/path
to the command line.
However, our tnsnames.ora
contains lines where multiple services are defined at once. They look like this:
NEWS2,NEWS,NEWSFX = (DESCRIPTION_LIST=...)
The OCI driver seems happy with this format, but the thin driver doesn't understand that those are 3 separate services NEWS2
, NEWS
and NEWSFX
. Some painful debugging sessions have revealed that it thinks this is a single service named NEWS2,NEWS,NEWSFX
.
Our DBA's are understandably not very keen on copy-pasting service descriptors left and right, and insist that we find a way to be able to declare different names for the same service descriptor without copy paste before switching from OCI to thin.
Is there a properly supported way to achieve this with the oracle thin driver?
PS: here's a post from a guy who is using that same feature, and also mentions that it is apparently undocumented: https://dbamarco.wordpress.com/2015/12/02/tnsnames-ora-secrets/
SERVICE_NAME is the new feature from oracle 8i onwards in which database can register itself with listener. If database is registered with listener in this way then you can use SERVICE_NAME parameter in tnsnames. ora otherwise - use SID in tnsnames. ora.
The sqlnet. ora file is the profile configuration file. It resides on the client machines and the database server. Profiles are stored and implemented using this file.
The tnsnames.ora file is a configuration file that defines connection parameters for your Oracle database instance. By default, tnsnames.ora resides in the following location: Solaris. Oracle_HOME/network/admin. Windows.
The TNSPING utility determines whether the listener for a service on an Oracle Net network can be reached successfully.
As of now, JDBC Thin driver doesn't support this feature. This will be one of the enhancements that our team will be working on. Sorry for the inconvenience. The only way is to provide the URL for each of the aliases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With