title: AS400 Data Connection in ASP.NET
body: <p>I have an application that will reside within a business2business network that will communicate with our AS400 in our internal network environment.  The firewall has been configured to allow the data request through to our AS400, but we are seeing a huge lag time in connection speed and response time.  For example what takes less than a half second in our local development environments is taking upwards of 120 seconds in our B2B environment.</p>
  
  <p>This is the function that we are utilizing to get our data.  We are using the enterprise library application blocks, so the ASI object is the Database...</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Generic function to retrieve data table from AS400
  /// &lt;/summary&gt;
  /// &lt;param name="sql"&gt;SQL String&lt;/param&gt;
  /// &lt;returns&gt;&lt;/returns&gt;
  private DataTable GetASIDataTable(string sql)
  {
      DataTable tbl = null;
  
      HttpContext.Current.Trace.Warn("GetASIDataTable(" + sql + ") BEGIN");
      using (var cmd = ASI.GetSqlStringCommand(sql))
      {
          using (var ds = ASI.ExecuteDataSet(cmd))
          {
              if (ds.Tables.Count &gt; 0) tbl = ds.Tables[0];
          }
      }
      HttpContext.Current.Trace.Warn("GetASIDataTable() END");
      return tbl;
  }
  </code></pre>
  
  <p>I am trying to brainstorm some ideas to consider as to why this is occurring.  </p>