Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDBC Thin connection string in Oracle uses both colon and forward slash

I wanted to know can we use both colon and forward slash with SID in making the connection URL in Oracle?

e.g.

jdbc:oracle:thin:@<host>:1521:<SID>
jdbc:oracle:thin:@<host>:1521/<SID>

Will these two are same and will work?

I am building an application which will work with both Oracle RAC and non RAC environments and RAC environments supports SERVICE NAME with forward slash so wanted to check will non RAC environment support forward slash .

For RAC environment URL is like this

jdbc:oracle:thin:@<host>:1521/<SERVICENAME>

Update This is different question because i want to ask is it possible to use both (: and / while using <SID> in the connection String which we call as OracleJDBCUrl .

like image 241
Deepak Jain Avatar asked May 10 '17 05:05

Deepak Jain


Video Answer


2 Answers

I was able to use both colon : and forward slash / for SID in connection URL and was able get the connection established. I think in Oracle 11g we can do such thing and for Service Name only we can use is forward slash / .

like image 174
Deepak Jain Avatar answered Oct 17 '22 14:10

Deepak Jain


We recommend to use the long form of the connection URL as show below.

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(HOST=myhost)(PORT=1521)(PROTOCOL=tcp))(CONNECT_DATA=(SERVICE_NAME=myorcldbservicename)))

Check out DataSourceSample and UCPSample for reference.

like image 1
Nirmala Avatar answered Oct 17 '22 15:10

Nirmala