tquilty@tqs.ie

OLEDB timeout after executing the same query

Discussion created by tquilty@tqs.ie on Oct 28, 2011
Latest reply on Oct 31, 2011 by michaelh

Hi All,

 

I have developed a .net reporting web application which takes a number of parameters and queries a PI server.

 

When executing a query that returns a sizeable result set the query works fine (returning within a few seconds). However when I execute the same query immediately after the first one completes the thread hangs and I get a OLEDB timeout exception.

 

I have installed the latest version of PI OLEDB and the PI SDK including the 1.3.8.391 patch.

 

The error occurs consistently on two Windows 2003 x86 machines using II6 but does not appear on my Win7 x64 dev machine using IIS7.5

 

Stack trace below.

 

Any ideas?

 

 

 

[OleDbException (0x80004005): Timeout has expired.]

 

   System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1003520

 

   System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +255

 

   System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +188

 

   System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58

 

   System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +161

 

   System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +116

 

Rest of stack trace omitted

 

 

 

Code is as follows:

 

 

 
                using (OleDbConnection cn = new OleDbConnection(Config.AlarmsPanelSettings.ConnectionStringPIServer))
                {
                    cn.Open();

                    using (OleDbCommand cmd = new OleDbCommand(buildPiQueryByDateRange(startDate.ToString(_DATE_TIME_FORMAT, CultureInfo.InvariantCulture), endDate.ToString(_DATE_TIME_FORMAT, CultureInfo.InvariantCulture), selectedSources), cn))
                    {
                        using (OleDbDataReader dataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection))
                        {
                            while ((dataReader.Read()))
                            {
                                if (dataReader["Status"].ToString() == "0")
                                    piRecords.Add(populatePIRecord(dataReader));
                            }
                        }
                    }
                }

 

 

 

 

 

Outcomes