Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Declaring multiple identical service in tnsnames.ora supported by oracle thin driver

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/

like image 676
LordOfThePigs Avatar asked May 28 '18 14:05

LordOfThePigs


People also ask

What is Service_name in Tnsnames Ora?

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.

What is the use of Sqlnet Ora in Oracle?

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.

What is TNS ORA file in Oracle?

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.

What is Oracle Tnsping?

The TNSPING utility determines whether the listener for a service on an Oracle Net network can be reached successfully.


1 Answers

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.

like image 158
Nirmala Avatar answered Sep 30 '22 14:09

Nirmala