How to connect to an Oracle Thin DB which is identified by 'Service Name' instead of SID

Originally posted by gmathai on May 23, 2019

There is a requirement for me to connect to an Oracle thin DB which is identified by ‘Service Name’ instead of SID.

Our DBA advised that SID is a thing of the past and they’re using Service Name now as best practice and for operational reasons.

But from SOAP UI Pro i dont see an option to enter Service Name in DB configurations, whereas SID is shown instead.

Please advice the steps to achieve this.

Originally posted by Terkon on May 23, 2019

Hi,

I am using the same setup. I simply put the service name into the SID field - workes fine for me.

With that I am using java class “ojdbc6.jar” in c:<yourInstallationFolder>\ReadyAPI-2.7.0\bin\ext

Attached you’ll find my settings. The “1” in the service name is for the cluster node I want to connect to. In a cluster environmend that is necessary to give.

Hope this helps

Terkon

Originally posted by TanyaYatskovska on May 27, 2019

Thanks for your suggestion, Terkon!

gmathai, were you able to resolve the issue?

Originally posted by gmathai on May 27, 2019

TanyaYatskovska / Terkon

After placing the ojdbc6.jar in the specified location, i am getting the attached error.

Originally posted by nmrao on May 27, 2019

Try checking with sqlplus or other client software to connect to the db and see if that is working.

Originally posted by gmathai on May 27, 2019

nmrao We are able to connect to this DB using Oracle SQL developer. Issue faced from SOAPUI though.

Originally posted by Terkon on May 27, 2019

Ok, I think that was a step in the right direction. Unfortunately this Error (Ora-12505) can have quite a lot of reasons.

Isn’t there a DB admin you can turn to?

Check out this:

https://chartio.com/resources/tutorials/how-to-fix-ora-12505-tns-listener-does-not-currently-know-of-sid-given-in-connect-descriptor/

Or maybe google some other sites with hints on that problem.

What does the TNS look like, which you use for the DB developer? And how the connection string in that tool?

Are you working on a cluster environment or is it a single instance DB?

Maybe you have to adjust your connection string in SOAPui or adjust the TNS so they fit to each other

Originally posted by TanyaYatskovska on May 31, 2019

Thanks for your help, Community!

gmathai, have you managed to find a solution. Please share it with us - it may help someone else.

Originally posted by rwilson352 on January 16, 2020

My intermediate-level knowledge of JDBC leads me to the conclusion that, unless Ready API specifically has a capability to add “Service Name” instead of SID, that this will never be possible. This StackOverflow question/answer demonstrates that the JDBC connection string will need to be of a different structure if one expects to use Service Name in lieu of SID: https://stackoverflow.com/questions/4832056/java-jdbc-how-to-connect-to-oracle-using-service-name-instead-of-sid

Many database clients have capability for Service Name / SID switching. Here are some examples:

SQL Developer

DBeaver

So I think the Ready API developers need to consider adding the option of Service Name-based JDBC functionality.

Originally posted by rwilson352 on January 16, 2020

To be clearer: the change that needs to be made is that ReadyAPI needs to allow connection strings to be in the following format:

jdbc:oracle:thin:user/[email protected]:1521/DBSCHEMA

currently, it only allows this (as far as I can tell):

jdbc:oracle:thin:user/[email protected]:1521:DBSCHEMA

The difference: the Service Name takes a / between it and the port, not a :

Another related SO Q&A:

https://stackoverflow.com/questions/18192521/ora-12505-tnslistener-does-not-currently-know-of-sid-given-in-connect-descript

Originally posted by rwilson352 on January 16, 2020

Further digging, I found this article: </t/connection-to-an-oracle-database-without-cid-but-with-servicename/676>

The solution is to manually edit either the driver or the connection string. See the accepted answer in the linked article. I was able to achieve it.

Originally posted by sonya_m on January 20, 2020

Hi rwilson352, thank you for digging into this and sharing the solution with us.

Originally posted by Terkon on January 21, 2020

Hi,

we are also using service name in our TNS files.

In the SOAPui environment config I just entered the service name in the SID field and it works.

Rg

Terkon