I'm having trouble with an Oracle update. The call to ExecuteNonQuery hangs indefinitely.
The code:
using (OracleCommand cmd = new OracleCommand(dbData.SqlCommandStr, conn))
{
foreach (string colName in dbData.Values.Keys)
cmd.Parameters.Add(colName, dbData.Values[colName]);
cmd.CommandTimeout = txTimeout;
int nRowsAffected = cmd.ExecuteNonQuery();
}
CommandTimeout is being set to 5, and the parameters are being set to small integer values.
The query:
UPDATE "BEN"."TABLE03" SET "COLUMN03"=:1,"COLUMN04"=:2 WHERE COLUMN05 > 0
The query runs quickly from sqlplus, and normally runs fast from my code, but every once in a while it hangs forever.
I ran a query on v$locked_object, and there's one record referring to this table, but I think that's the update that isn't completing.
There are two things I would like to know: What might cause the update to hang?
More importantly, why isn't an exception being thrown here? I would expect the call to wait five seconds, and then timeout.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…