locked
System.Data.Odbc.OdbcException (0x80131937): ERROR [HYT00] [Microsoft][SQL Server]Query timeout expired RRS feed

  • Question

  • SQL Server version: MSSQL 2012 64-bit MS OS version: Windows Server 2012 Standard R2 64-bit IIS version: 8.5 Database Recovery Mode: Full

    The architecture described below:

    Client ---------> Server (IIS) ------------> MSSQL DB https ODBC

    1) Our application (written in c#) running at Server uses ODBC driver( ODBC interface) to access the MS SQL Database. 2) Our application receives hundreds of request (string of length between 240 byte to 420 byte) from client in any given seconds. 3) Each of this request is processed concurrently.

    Upon receiving this message:

    3.1 Begin Transaction

    3.2 Updates a table[XXXXXX]

    3.3 Perform Select query on table[YYYYYYYY] to check if the message received exist in table[YYYYYYYY] or not.

    3.4 Perform Insert/Update on table[YYYYYYYY] based of the Select query.

    3.5 Commit Transaction *** The issue happens at item 3.4 after sometime and throws exception (stated below) and Rollback Transaction is performed: System.Data.Odbc.OdbcException (0x80131937): ERROR [HYT00] [Microsoft][SQL Server]Query timeout expired at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader) at System.Data.Odbc.OdbcCommand.ExecuteNonQuery()

    What could cause the exception to occur? Is there any setting need to be set?

    Thank You.

    Regards, Kishen Sivalingam

    Friday, August 14, 2015 10:46 AM

Answers

  • >Query timeout expired

    This means that your app has given up on waiting on the query to complete because the DbCommand.CommandTimeout that you set (or left at the 30 sec default) has expired.  You can extend this timeout, but it's probably better to diagnose why the queries are taking so long.

    So why are the queries taking so long?  You'll have to look at SQL Server for that.  Could be blocking, or resource (CPU, IO) contention, or you could be auto-growing your database or log files.

    David


    David http://blogs.msdn.com/b/dbrowne/

    Friday, August 14, 2015 1:17 PM