title: Oracle query is slow (or fails) from .NET app but is fast from SQL Developer
body: <p>We use ODP.NET to perform queries on Oracle databases, and normally it works fine. There is a particular database, and a particular view in that database, though, that we just can't complete a query on from .NET. For example:</p>
  
  <pre><code>SELECT some_varchar_field FROM the_view WHERE ROWNUM &lt; 5;
  </code></pre>
  
  <p>If I execute this query from within Oracle SQL developer, it finishes in less than a second. If I do an identical query from our .NET application using ODP.NET, it hangs and eventually produces an "ORA-03135: connection lost contact" error. I think that limiting it to just a few rows eliminates the possibility that it is as FetchSize issue.</p>
  
  <p>There are other queries I can execute successfully, but they are slower from our program than from SQL Developer. Again, I realize SQL Developer only gets data for the first 50 rows initially, but I think the ROWNUM condition takes that out of the equation.</p>
  
  <p>What might be different about the connection or command that Oracle SQL Developer is using vs the one our application is using that would cause a difference in speed?</p>
  
  <p>Unfortunately, I do not have access to the server (other than to run Oracle queries against it).</p>
  
  <p>Thank you.</p>
  
  <p>UPDATE: I have tried the same query with Microsoft's Oracle provider and it executes very quickly. Unfortunately, that provider is deprecated so this is not a long term solution.</p>