title: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor while connecting as JDBC remote client
body: <p>I have gone through all the suggestions given by many of you for this query. But unfortunately none of them has fixed my issue.</p>
  
  <p>Problem:- I have installed Oracle12c into a our remote machine(Host1) and by default ORCL database has created and running. After that by using Database configuration Assistant I have created new database "YILIDB". I can connect to these databases from Host1 through sqldeveloper tool. But when I'm trying to access the above databases from another machine (Host2) I can't connect to it. First I tried by using JDBC code to connect to that data base. I got the below Exception.</p>
  
  <h1>Code:-</h1>
  
  <pre><code>Class.forName("oracle.jdbc.driver.OracleDriver");
  Connection conn = DriverManager.getConnection("jdbc:oracle:thin:172.26.8.188:1521:YILIDB", "WM6",
                  "WM6");
  </code></pre>
  
  <h1>Error:-</h1>
  
  <pre class="lang-none prettyprint-override"><code>java.sql.SQLException: Listener refused the connection with the following error:
  ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
  at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:825)
  at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:755)
  at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:38)
  at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:599)
  at java.sql.DriverManager.getConnection(DriverManager.java:571)
  at java.sql.DriverManager.getConnection(DriverManager.java:215)
  at ConnectionTest.main(ConnectionTest.java:39)
  Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
  ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
  
      at oracle.net.ns.NSProtocolStream.negotiateConnection(NSProtocolStream.java:324)
      at oracle.net.ns.NSProtocol.connect(NSProtocol.java:287)
      at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1963)
      at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:564)
      ... 6 more
  </code></pre>
  
  <p>And when I'm trying to connect from Host2 sqldeveloper to Host1 database I got below error which means basically I can't connect to remote database neither with JDBC code nor using sqldeveloper.</p>
  
  <h1>Error while I'm trying to connect from sqldeveloper:-</h1>
  
  <blockquote>
    <p>Status: Test-failed: IO error the network adapter could not establish the connection</p>
  </blockquote>
  
  <p>And In the remote database machine I have verified services. Both ORCL and YILIDB services are running. I see only one listener in services up and running.</p>
  
  <p>Can someone please provide me the solution for this.</p>
  
  <p>Find the status of >lsnrctl status below</p>
  
  <pre class="lang-none prettyprint-override"><code>C:\Users\Administrator&gt;lsnrctl status
  
  LSNRCTL for 64-bit Windows: Version 12.1.0.1.0 - Production on 25-OCT-2016 14:14:41
  
  Copyright (c) 1991, 2013, Oracle.  All rights reserved.
  
  Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
  STATUS of the LISTENER
  ------------------------
  Alias                     LISTENER
  
  Version                   TNSLSNR for 64-bit Windows: Version 12.1.0.1.0 - Production
  
  Start Date                25-OCT-2016 14:04:56
  Uptime                    0 days 0 hr. 9 min. 44 sec
  Trace Level               off
  Security                  ON: Local OS Authentication
  SNMP                      OFF
  Default Service           YILIDB
  Listener Parameter File   C:\app\Administrator\product\12.1.0\dbhome_1\network\admin\listener.ora
  Listener Log File         C:\app\Administrator\diag\tnslsnr\SMYB2SW12-Yili\listener\alert\log.xml
  Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.pipe\EXTPROC1521ipc)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.28.8.199)(PORT=1521)))
  Services Summary...
  Service "CLRExtProc" has 1 instance(s).
    Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
  
  The command completed successfully
  </code></pre>