0

I have a small web app that runs sql queries for users, that prints the results to pdf/csv. For larger queries, I am getting this error:

ERROR [57014] [IBM][DB2/AIX64] SQL0952N  Processing was cancelled due to an interrupt.  SQLSTATE=57014

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: IBM.Data.DB2.DB2Exception: ERROR [57014] [IBM][DB2/AIX64] SQL0952N  Processing was cancelled due to an interrupt.  SQLSTATE=57014

After doing research, It turns out I need to add a QueryTimeout parameter to my connection string. I don't have much experience with vb.net aside from some simple edits. My relevant code looks like this:

Imports IBM.Data.DB2
Dim conn As New DB2Connection(ConfigurationManager.AppSettings(ddDatabase.SelectedValue))
Dim cmd As New DB2Command(strSQL, conn)
4

1 回答 1

1

如果我理解您的问题,我认为您应该在 DB2Command 上设置 CommandTimeout 而不是允许建立连接的最大时间

Imports IBM.Data.DB2
Dim conn As New DB2Connection(ConfigurationManager.AppSettings(ddDatabase.SelectedValue))
Dim cmd As New DB2Command(strSQL, conn)
cmd.CommandTimeout = 200

DB2.CommandTimeout

等待命令执行的时间(以秒为单位)。默认值为 30 秒。

于 2013-07-29T16:02:34.990 回答