title: C# application doesn't get timed out if Oracle stored procedure takes a longer time to execute
body: <p>We have an in-house application that executes the Oracle stored procedure on the vendor side. Once the stored procedure is completed on the vendor side, it will return true or false (failure or success).</p>
  <p>Currently we have this scenario: in the <code>Application</code> table, we mention the Oracle stored procedure name, timeout setting, parameters, and other details.</p>
  <ol>
  <li>Srno      &lt;1&gt;</li>
  <li>SprocName &lt;abc_sproc&gt;</li>
  <li>TimeoutSetting   &lt;3000&gt;  (seconds)  ---&gt; 5 minutes</li>
  <li>Parameter_1  &lt;&gt;</li>
  <li>Parameter_2  &lt;&gt; etc.</li>
  </ol>
  <p>A C# application will take these details from the table and execute the stored procedure accordingly.</p>
  <ul>
  <li>Best case: the executions completes before the timeout setting</li>
  <li>Worst case: the stored procedure execution goes beyond the timeout setting</li>
  </ul>
  <p>So in the worst case, let's say <code>abc_sproc</code> ran about 5 mins 30 seconds on the vendor side. But the timeout doesn't get raised at the C# application end and it shows that job is still running. During the investigation, we find that stored procedure runs perfectly fine without any issues at the vendor's end and we have to manually kill the job from outside.</p>
  <p>So I need your help or suggestion to improve my code so that we can capture/raise the proper timeout errors in the C# application. Please feel free to ask any questions or if you need more information!</p>
  <p>Solutions attempted:</p>
  <ul>
  <li>Added <code>OracleException</code> and <code>TimeOutException</code> clause in <code>Catch</code> statement</li>
  </ul>
  <p>C# Driver used to connect Oracle: Oracle.ManagedDataAccess.dll</p>
  <p>App Config:</p>
  <pre><code>&lt;configuration&gt;
      &lt;configSections&gt;
             &lt;section name=&quot;oracle.manageddataaccess.client&quot; type=&quot;OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess&quot; /&gt;
  &lt;/configSections&gt;
  &lt;oracle.manageddataaccess.client&gt;
      &lt;version number=&quot;*&quot;&gt;
        &lt;settings&gt;
          &lt;setting name=&quot;Disable_Oob&quot; value=&quot;on&quot; /&gt;
        &lt;/settings&gt;
      &lt;/version&gt;
    &lt;/oracle.manageddataaccess.client&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>Execution Method:</p>
  <pre><code>    public int ExecuteData(string connectionName, Procs procDetails) {
        int returnValue = -1;
        try { //code
      
          returnValue = database.ExecuteSP(procDetails.ProcedureName, lstDataParameters, procDetails.CommandTimeout);
        } catch (OracleException ex) {
          string exMsg = string.Empty;
          switch (ex.Number) {
            //Login failed
          case 1017:
            exMsg = !string.IsNullOrEmpty(ex.Message) ? ex.Message : string.Format(&quot;Login failed - &quot; + connectionName);
              
            //Timeout exception
          case 1013: {
            exMsg = !string.IsNullOrEmpty(ex.Message) ? ex.Message : string.Format(&quot;Command timeout failed -&quot; + connectionName
            });
      
          }
          //Invalid parameters
          case 6550:
            exMsg = !string.IsNullOrEmpty(ex.Message) ? ex.Message : string.Format(&quot;Invalid parameters provided&quot; + connectionName);
      
          default: throw ex;
        }
      }
      catch (TimeoutException ex) {
        string exMsg = string.Empty;
        exMsg = string.Format(&quot;Timeout Exception Occurred - &quot; + connectionName);
      }
  </code></pre>
  <p>Thanks in advance,
  HP</p>