title: Oracle Error: ORA-12541: TNS:no listener
body: <p>I am using VS2013 and oracle 11g for database. Oracle developer suite 10g is also installed in my machine. I am trying to connect my database using</p>
  
  <pre><code>public void connect()
      {
          try
          {
  
              conString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=" + "(ADDRESS=(PROTOCOL=" + txtBoxProcol.Text + ")(HOST=" + txtBoxHost.Text + ")(PORT=" + txtBoxPort.Text + ")))" + "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" + txtBoxDSource.Text + ")));" + "User Id=" + txtBoxUsr.Text + ";Password=" + txtBoxPaswrd.Text + "enlist=false; pooling=false;";
              con = new OracleConnection();
              con.ConnectionString = conString;
              con.Open();
              MessageBox.Show("Connected Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
          }
          catch (OracleException ex) // catches only Oracle errors
          {
              switch (ex.Number)
              {
                  case 1:
                      MessageBox.Show("Error attempting to insert duplicate data.");
                      break;
                  case 12545:
                      MessageBox.Show("The database is unavailable.");
                      break;
                  default:
                      MessageBox.Show("Database error: " + ex.Message.ToString());
                      break;
              }
          }
          finally
          {
              con.Clone();
              con.Dispose();
          }
      }
  </code></pre>
  
  <p>But I got following error </p>
  
  <p>Oracle Error: ORA-12541: TNS:no listener</p>
  
  <p>Changing the conString to </p>
  
  <pre><code> conString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=" + "(ADDRESS=(PROTOCOL=TCP)(HOST=DESKTOP-3B866TI)(PORT=1521)))" + "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)));" + "User Id=scott;Password=tiger;";
  </code></pre>
  
  <p>is also not working.</p>
  
  <p>My <strong>TNSNAMES.ORA</strong></p>
  
  <pre><code>ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  )
  (CONNECT_DATA =
    (SID = CLRExtProc)
    (PRESENTATION = RO)
  )
  )
  
  ORCL =
  (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
  (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orcl)
  )
  )
  </code></pre>
  
  <p>And <strong>Listener.ora</strong> is </p>
  
  <pre><code>SID_LIST_LISTENER =
  (SID_LIST =
  (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = c:\app\hanna\product\11.2.0\dbhome_1)
    (PROGRAM = extproc)
    (ENVS =      "EXTPROC_DLLS=ONLY:c:\app\hanna\product\11.2.0\dbhome_1\bin\oraclr11.dll")
  )
  (SID_DESC=
  (GLOBAL_DBNAME = PLSExtProc)
  (ORACLE_HOME = c:\app\hanna\product\11.2.0\dbhome_1)
  (SID_NAME = ORCL)
  )
  )
  
  LISTENER =
  (DESCRIPTION_LIST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
  )
  )
  </code></pre>
  
  <p>Oracle_Home in Registry has value = C:\app\hanna\product\11.2.0\dbhome_1
  I have run lsnrctl stop lsnrctl start commands in cmd. But my connection is not opening. In SQL *PLUS my connection works fine.</p>