Connection to an Oracle database without CID, but with Servicename

Originally posted by abbas on June 15, 2016

Hi everybody, I cann’t configure the connection to Oracle database, because there is no CID. I must configure it just with servicename! Thanks for your support. Abbas

Originally posted by NBorovykh on June 15, 2016

Hello Abbas,

The connection string templates in R!API are customizable. You can edit them on the “JDBC drivers” tab in preferences.

In your case, I guess, you need to replace

jdbc:oracle:thin:<USER>/<PASSWORD>@<HOST:127.0.0.1>:<PORT:1521>:<SID>

with

jdbc:oracle:thin:<USER>/<PASSWORD>@<HOST:127.0.0.1>:<PORT:1521>/SERVICE

where instead of “SERVICE” you need to provide your real service name (e.g. “orcl”).

Originally posted by MFagerlind on June 15, 2016

You probably want to go with Nathalie’s advice above, but if you want to change the Connection string for just one JDBC request, you could change the Configuration Connection to . This will make the Connection string, Driver and password fields editable.

Regards,

Manne, Developer

Originally posted by abbas on June 15, 2016

Thank you for this message, but I tried it and got the following error:

Failed to init connection for driver [oracle.jdbc.driver.OracleDriver], connectionString [jdbc:oracle:thin:/@:1521/SHOPTEST]

!!!

Cheers

Abbas

Originally posted by MFagerlind on June 15, 2016

The error message seems to indicate that the host name is missing in the connection string. Did you delete it by accident?

Did you use Nathalie’s approach or the one I suggested?

Regards,

Manne

Originally posted by nmrao on June 15, 2016

Oracle Host name is missing in your case.

Originally posted by abbas on June 15, 2016

I used the following configuration:

Driver: OracleThin/oracle.jdbc.driver.OracleDriver

Connection String template: jdbc:oracle:thin:/@HOST:10.7.1.50:PORT:1521/SHOPTEST

and I have contact to the named database with SQL Developer, but I get the following error:

" Failed to init connection for driver [oracle.jdbc.driver.OracleDriver], connectionString [jdbc:oracle:thin:/@10.7.1.50:1521/SHOPTEST] "

What I did:

1- in config Coection String template like above

2- Database Configuration -->New

  Driver: OracleThin/oracle.jdbc.driver.OracleDriver

  Host: 10.7.1.50

  Port: 1521

3: Click Test connection —> Result: Erorr:

" Failed to init connection for driver [oracle.jdbc.driver.OracleDriver], connectionString [jdbc:oracle:thin:/@10.7.1.50:1521/SHOPTEST] "

Originally posted by abbas on June 15, 2016

And the same problem with the following Connection String:

jdbc:oracle:thin:catalog/catalog@HOST:ractest-scan:PORT:1521/SHOPTEST

Originally posted by nmrao on June 15, 2016

Looks something trivial.
See here http://stackoverflow.com/questions/4832056/java-jdbc-how-to-connect-to-oracle-using-service-name-instead-of-sid

Originally posted by dd1984 on June 29, 2016

Hi Rao,

I am also facing the same issue and when using the String suggested in stack overflow it’s working fine but still when try to configure the Db connection it says SID is mandatory field.

What input should i give in SID field.

Originally posted by dd1984 on June 29, 2016

Hi,

thank you TanyaGorbunova !!! It’s working :slight_smile:

Your solution is working for me but it’s limiting me to test one database only. I have multiple environments and different service name for each data base.

Please suggest how to manage that.

Best regards,

Originally posted by JKambli on June 29, 2016

If in a single Environment, if you use 1 database connection then on Databases tab > add 1 connection string.

http://readyapi.smartbear.com/readyapi/databases/start

Once you do that go to Environments > Add environment > JDBC connection > Edit the connection string for that environment.

Originally posted by dd1984 on June 29, 2016

Hi,

I tried that but it’s over riding the value of connection string i used in Environments with the connection String in JDBC driver.

Here is the set up for oracle.jdbc.driver.OracleDriver

1.Under preferences used jdbc:oracle:thin:/:host:port/servicename --service name say sampleTest1.se

2.Created single database entry in Databases jdbc:oracle:thin:/:host:port/sampleTest1.se

3.Create a test environement test with database where service name is same as i setup in preferences >JDBC driver

jdbc:oracle:thin:/:host:port/sampleTest1.se --works fine

4.Create a test environement test 2 with database where service name is different say sampleTest2.se --being override with sampleTest1.se

So now service name in database string of 4th from above is being override by the service name i have used in 1st step above.

Please confirm if i missed anything.

Thank you!!

Originally posted by JKambli on June 29, 2016

I cannot reproduce this issue on 1.7.0 version, make sure you edit the JDBC connection for other environment. I am not sure if I understand the exact issue, can you provide screenshots?

Originally posted by abbas on June 29, 2016

Hi there,

you have to set your DB oracle configuration in bin/ext and restart your Redy API! You don’t need SID.

It works.

Cheers

Abbas