Dealing with the Error "ERROR [HY008] [IBM][CLI Driver][DB2/NT] SQL0952N Processing was cancelled due to an interrupt. SQLSTATE=57014"

During a recent DB2 to SQL Server conversion, I received the following run-time exception:

ERROR [HY008] [IBM][CLI Driver][DB2/NT] SQL0952N Processing was cancelled due to an interrupt. SQLSTATE=57014

A little research showed me that the error typically occurs when a SQL query against a DB2 database runs an excessively long time. To address or get around this, you can adjust the CommandTimeout property of the DB2Command object. Increase the value to allow more time for your query.

While there's quite a few links concerning this issue, the following was most helpful:

http://www-01.ibm.com/support/docview.wss?uid=swg21424265

Addendum

Ideally, you should look into why the query ran so long in the first place. In my case, I found that a a single row in my Invoices table (and likewise in my Payments table) had some issues with a pseudo foreign key. That is, someone was using a column like a foreign key, there was no official foreign key constraint which used this column, and at some point the values for this row were in an invalid state. Thus, the query I was using was most likely caught in some sort of circular Hell.

Since I didn't and couldn't know what the proper values for this row should be, I ended up changing my exception handling (a trusty try...catch statement) so that in the Release build the application would log the offending row and continue on with the remaining rows.

Comments

Popular posts from this blog

Using Reference Aliases

List of Visual Studio Keyboard Shortcuts