oracle ExecuteNonQuery在ASP.Net上冻结 [英] oracle ExecuteNonQuery freezes on ASP.Net

查看:62
本文介绍了oracle ExecuteNonQuery在ASP.Net上冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在带有CLR 4.5的ASP C#中使用Oracle连接运行非查询.这是我的代码:

I am trying to run a non query using a Oracle connection in ASP C# with CLR 4.5. Here is my code:

    string connectionString = ConfigurationManager.ConnectionStrings["OracleConnectionString1"].ConnectionString;
    OracleConnection conn = new OracleConnection(connectionString);
    conn.Open();
    OracleCommand cmd = new OracleCommand();
    cmd.Connection = conn;
    cmd.CommandText = "update SALES_ADVENTUREWORKS2012.SALESORDERDETAIL set UNITPRICEDISCOUNT=0 where ROWGUID='4A399178-C0A0-447E-9973-6AB903B4AECD'";
    cmd.CommandType = CommandType.Text;
    cmd.CommandTimeout = QUERY_TIMEOUT;
    int row_affected = cmd.ExecuteNonQuery();
    HttpContext.Current.Response.Write("Rows affected:" + row_affected + "<br/>");
    conn.Close();

当我在oracle开发工具中运行查询时,它运行良好. 当我使用上面的asp代码时,执行查询时它会冻结.即使我使用了5秒钟的超时,它也会永久冻结. 我试过使用托管和非托管的oracle库.两者的行为相同. 请注意,使用填充或标量查询可以很好地工作,因此我的连接字符串没有任何问题.同样,Oracle开发人员可以执行此更新查询的事实也证明这不是权限问题.

when I run the query in oracle development tool, it works fine. when I use the asp code above, it freezes when performing the query. It freezes forever even though I used a 5 second timeout. I've tried using the managed and unmanaged oracle libraries; both behave the same. Note that using the fill or scalar query work perfectly fine so there is nothing wrong with my connection string. Also the fact that oracle development can perform this update query proves that this is not a permission problem.

有什么想法吗?

推荐答案

您的查询很可能正在等待访问记录.您可能已经在"oracle开发工具"中修改了该行,但尚未提交或回滚该事务.

Most likely your query is waiting to get access to the record. You probably have modified that row in "oracle development tool" and have not committed or rolled back that transaction.

只需在您的工具中提交/回滚或关闭打开的会话即可. 您可以在v $ transaction视图中检查未结交易.

Just commit/rollback in your tool or close open session. You can check for open transactions in v$transaction view.

有关Oracle中自动锁的更多信息: http://docs.oracle.com/cd/E11882_01/server .112/e41084/ap_locks001.htm

More on automatic locks in Oracle: http://docs.oracle.com/cd/E11882_01/server.112/e41084/ap_locks001.htm

这篇关于oracle ExecuteNonQuery在ASP.Net上冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆