title: Oracle Database Connection Error Listener Refused the Connection
body: <p>I just installed Oracle 11g on my work dev computer which has Windows 7 64-bit and is on a network with a domain set up.  When I try to connect to the "XE" database/SID using SQL Developer I get the following errors list below.</p>
  
  <p>Any ideas?</p>
  
  <p>I've researched online and tried a number of the solutions suggested and cannot get it to work.  I can confirm the following:</p>
  
  <ol>
  <li>The database is started. I can connect using SQL Plus.</li>
  <li>Both the OracleServiceXE and OracleXETNSListener services are started</li>
  <li>Internet Information Systems (IIS) is installed and working properly.</li>
  <li>In addition to not being able to connect with SQL Developer, when I the the "Get Started" web application, it doesn't work.</li>
  </ol>
  
  <p>When I first tried to connect, the settings in SQL Developer were as follows:</p>
  
  <pre><code>Hostname: localhost
  Port: 1521
  SID: xe
  </code></pre>
  
  <p>However, I got the following error:</p>
  
  <pre><code>Status : Failure -Test failed: Listener refused the connection with the following error: ORA-12505
  </code></pre>
  
  <p>After researching I found that I should look at the listener end points (whatever that means) in the "listner.ora" file and confirm the hostname.  That file has the following:</p>
  
  <pre><code>SID_LIST_LISTENER =
      (SID_LIST =
          (SID_DESC =
            (SID_NAME = PLSExtProc)
            (ORACLE_HOME = C:\Oracle\oraclexe\app\oracle\product\11.2.0\server)
            (PROGRAM = extproc)
          )
          (SID_DESC =
            (SID_NAME = CLRExtProc)
            (ORACLE_HOME = C:\Oracle\oraclexe\app\oracle\product\11.2.0\server)
            (PROGRAM = extproc)
          )
        )
  
  LISTENER =
    (DESCRIPTION_LIST =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
        (ADDRESS = (PROTOCOL = TCP)(HOST = mycomputername.abc.de.mycompany.com.)(PORT = 1521))
      )
    )
  
  DEFAULT_SERVICE_LISTENER = (XE)
  </code></pre>
  
  <p>When I saw that the host name was different I first tried changing "HOST" in the listener.ora file from "mycomputername.abc.de.mycompany.com." to "localhost"  and then to "127.0.0.1" (note the previous really has an extra period at the end).  After doing that, I still got the same error message.</p>
  
  <p>Then, I put everything back the way it was in the "listener.ora" file and instead went to SQL Developer and changed my login information to the following:</p>
  
  <pre><code>Hostname: mycomputername.abc.de.mycompany.com.   (again... there really is a period at the end)
  Port: 1521
  SID: xe
  </code></pre>
  
  <p>I even tried it with just "mycomputername". Again, I got the error message:</p>
  
  <pre><code>Status : Failure -Test failed: Listener refused the connection with the following error: ORA-12505
  </code></pre>