Weblogic 12c Oracle Datasource TNS Exception

Problem

While creating a Oracle Data source in weblogic 12c, If you are encountering the below error message upon TestConnection.

Though all the SID(Database name) and Host and Port are Correct

Listener refused the connection with the following error:
 ORA-12505, TNS:listener does not currently know of SID given in connect descriptor 
<br/>oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:743).
<br/>oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666)
<br/>oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
<br/>oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566)
<br/>weblogic.jdbc.common.internal.DataSourceUtil.testConnection0(DataSourceUtil.java:340)<br/>weblogic.jdbc.common.internal.DataSourceUtil.access$000(DataSourceUtil.java:22)<br/>weblogic.jdbc.common.internal.DataSourceUtil$1.run(DataSourceUtil.java:254)<br/>java.security.AccessController.doPrivileged(Native Method)<br/>weblogic.jdbc.common.internal.DataSourceUtil.testConnection(DataSourceUtil.java:251)<br/>com.bea.console.utils.jdbc.JDBCUtils.testConnection(JDBCUtils.java:751)

For Example: Given below is my JDBC URL string where

dbserver.mwinventory.in is my DB HOST

userrepo is my SID/DATABASE NAME

Full Connection URL: jdbc:oracle:thin:@dbserver.mwinventory.in:1522:usersrepo

wls12c-tns

Solution

As obvious, the solution to the problems are always simple

You just have to tweak your Connection URL

From:

jdbc:oracle:thin:@dbserver.mwinventory.in:1522:usersrepo

to

jdbc:oracle:thin:@dbserver.mwinventory.in:1522/usersrepo

 

Yes, You got it right!. It's just replacing ":" Colon with "/" slash

wls12c-tns-success

I was actually banging my head for lot of time. I hope I saved your head ūüôā