Global Data Management Forum

 View Only

CommandTimeout not working with StoredProcedure

  • 1.  CommandTimeout not working with StoredProcedure

    Posted Wed October 19, 2022 06:41 AM
    Hello,
    On dotnet program, CommandTimout property does not work when i run StoredProcedure.
    This timeout is well fired when call SQL query.
    Is it a limitation of the driver ?

    version : Net5.IBM.Data.Db2 (5.0.0.500)

    sample code :
    using DB2Connection conn = new DB2Connection(connectionString);
    unsing DB2Command cmd = new DB2Command
    {
        Connection = conn,
        CommandText = "complex sql select",
        CommandType = CommandType.Text,
        CommandTimeout = 1
    };
    var reader = cmd.ExecuteReaderAsync(CommandBehavior.CloseConnection);​​
    await reader.ReadAsync();

    this code fire exception  "ERROR [57014] [IBM][AS] SQL1044N Processing was cancelled due to an interrupt." => look OK



    using DB2Connection conn = new DB2Connection(connectionString);
    unsing DB2Command cmd = new DB2Command
    {
        Connection = conn,
        CommandText = "client.storedProcedure",
        CommandType = CommandType.StoredProcedure,
        CommandTimeout = 1
    };
    var reader = cmd.ExecuteReaderAsync(CommandBehavior.CloseConnection);​
    await reader.ReadAsync()

    This sample do not stop after 1 second and no exception is fired => problem ?



    ------------------------------
    thomas le magourou
    ------------------------------

    #DataManagementGlobal
    #DataServerDrivers