Home
> JDBC, Oracle > ORA-12505: TNS:listener does not currently know of SID given in connect descriptor
ORA-12505: TNS:listener does not currently know of SID given in connect descriptor
I am not sure why I get this error since I can connect to the current SID by using sqlplus but I cannot connect to it by using jdbc with the following url:
jdbc:oracle:thin:@aHost:1521:theSID
After searching for about an hour I found out that you can also use the full blown jdbc url protocol to connect to oracle
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=aHost) (PORT=1521))(CONNECT_DATA=(SERVICE_NAME=theSID)))
This does not explain why the issue happens but at least for now it solves the problem. I will post an update if I find anything else.
Thanx. It is really helpful.
Iam trying to connect iReropt to Oracle db using Database JDBC Connection wizard.
I tried the same way as you mentioned and it works the same way it worked for you.
i.e. when i mention the full blown jdbc url, it is connecting successfully, but not for jdbc:oracle:thin:@myHost:1521:mySID. Dont know why ??
Not sure why it’s doing it. Maybe the application server does not like something in the URL. Not sure.
Hi,
As I understand, you are using service name instead of SID.
URL for conenctions based on service names should be in this format…
jdbc:oracle:thin:@//aHost:1521/theSID
This was really helpful for me !! Thanks
thabkyou .It works π
Panos and tomim!
Thank you very much
Dear Panos,
Thank you for the information.
I have the same message in my PC while I try to connect SQL developer with the Oracle database.
Do you know where to make this change of JDBC driver?
Thank you,
Labrini
Hi Labrini, you should put the full URL in the field where you define the format of the jdbc url protocol. Not sure where exactly this is, I have never used SQL Developer. Have a look at the SQL Developer documentation for more information.
Interesting. I’ve never had such error. A simple connection string always worked for me.
plz tell me what i use insted of SID?
No luck π¦ , Tried out all the three options below to connect to the Oracle10g XE but getting the same exception ORA-12514 :
1.jdbc:oracle:thin:@localhost:1521:TelusDB
2.jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=TelusDB)))
3.jdbc:oracle:thin:@localhost:1521:TelusDB
where TelusDB is the DB name i created in Oracle.
sry, correction to the third option above :
3. jdbc:oracle:thin:@//localhost:1521/TelusDB
π¦ π¦ π¦
Help pls
thanks–it really helped
Life saver, took me hours finding out how to fix this
Hi, I am Suresh Mopada. I had the same problem but its resolved for me.
i am using window 7 64 bit operating system and oracle 10 g.
while try to connect oracle database (database SID: orcl, username: system, password: manager) using jdbc type 4 driver (thin). i got the error ORA:12505.
i found all tns entries are correct and listener also running.. but still i got the error due to the
statement which i used in JDBC program.
old type !V driver syntax:
try{
Class.forName(“oracle.jdbc.driver.OracleDriver”);
Connection con = DriverManager.getConnection(“jdbc:oracle:thin:@localhost:1521:XE”,”system”,”manager”);
System.out.println(con);
}catch(Exception e)
{
e.printStackTrace();
}
O/P causes the ORA:12505 error.
in windows 7 64 bit operating system the above code not worked for me. so i change the JDBC code see below.
New code:
try{
Class.forName(“oracle.jdbc.driver.OracleDriver”);
Connection con = DriverManager.getConnection(“jdbc:oracle:thin:@localhost:1521:orcl”,”system”,”manager”);
System.out.println(con);
}catch(Exception e)
{
e.printStackTrace();
}
Note: you have to mention your SID in the Connection string. in my scenario orcl is my SID, at the time oracle installation i given that name.
O/P oracle.jdbc.driver.T4CConnection@b169f8
I hope it will help you.
if you have any queries, you can reach me on sureshm1986@gmail.com
I have tried exactly like that
previously it is working for me, but suddenly its not working for me.
I am giving exactly the same thing.
iam using oracle 12c.
i have also crosschecked the tnsnames.ora file generated by oracle.
SID is orcl.
don’t know why it is happening.
I have checked my listener status too through cmd, don’t know what others option i have.
Guy, you saved my life ! haha, thank you !
A big Thank to Panos. It worked.
Thanks, you saved my day! π
There are another solution for ora-12505, if you are using windows you can just run msconfig and find your SID and change it then the problems should be solved. For more details you can visit http://blackandwhitecomputer.blogspot.com/2013/11/error-ora-12505-oracle-sql-developer.html
Thanks @Panos. I was needing how to specify the the SID value in connection string in iReport:
jdbc:oracle:thin:@ServerName:Port:SID
Thanks for saving me an hour π
Thank you very much Panos