title: Oracle connection ok but ORA-12170: TNS:Connect timeout occurred when executing queries
body: <p>I have some errors executing queries against a oracle 11g database from a .net c# console application. The connection seems to be established properly (the <code>conn.State</code> property is <code>Open</code> after the following lines)</p>
  
  <pre><code>OracleConnection conn = new OracleConnection(connString);
  conn.Open();
  </code></pre>
  
  <p>but when launching any query I get an <strong>ORA-12170</strong> error (Connect timeout ocurred). I don't think the problem is in the code as the same test against another database works properly.</p>
  
  <pre><code>Connection.State is Open
  
  Error: ORA-12170: TNS:Connect timeout occurred
     at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
     at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
     at Oracle.DataAccess.Client.OracleConnection.Open()
     at Proj1.DB.OracleProj1.GetOpenConn(String connString) in C:\WorkTV\src\projects\OracleProj1\source\Core\Proj1Core\DB\OracleProj1.cs:line 560
     at Proj1.DB.OracleProj1.AddLog(DateTime start, DateTime end, Int32 userID, String ip, Int32 assetID, Int32 segmentID, Int32 flowID, Int32 permissionID, Int32 permissionSubtype, Int32 resultCode, String resultDescription, String resultLog) in C:\WorkTV\src\projects\OracleProj1\source\Core\Proj1Core\DB\OracleProj1.cs:line 3513
     at Proj1.Util.Tool.AddLog(Int32 resultCode, String resultDescription, String resultLog) in C:\WorkTV\src\projects\OracleProj1\source\Core\Proj1Core\Util\Tool.cs:line 177
     at Proj1.DB.OracleProj1.ExecuteNonQuery(OracleConnection conn, String query, String&amp; log, Proj1Object Proj1Object) in C:\WorkTV\src\projects\OracleProj1\source\Core\Proj1Core\DB\OracleProj1.cs:line 638
     at Proj1.DB.OracleProj1.TestConnection(String connString) in C:\WorkTV\src\projects\OracleProj1\source\Core\Proj1Core\DB\OracleProj1.cs:line 315
  
  Connection.State is Closed
  </code></pre>
  
  <p>I can connect to this database through <em>Oracle SQL Developer</em>, with the same user, and insert/delete rows successfully.</p>
  
  <p>When trying to connect with <em>sqlplus</em> throught command line I get an <strong>ORA-12560: TNS:protocol adapter error</strong>, so I cannot make any test.</p>
  
  <p>All the oracle services are running.</p>
  
  <p>Command <code>Lsnrctl status</code> says:</p>
  
  <pre><code>Instance "xxx", status READY, has 1 handler(s) for this service...
  </code></pre>
  
  <p>Any help related to any of both errors will be appreciated.</p>