ORACLE TIMEOUTS - 如何使用此连接字符串设置更长的超时?

时间:2010-12-15 19:07:11

标签: oracle

我在.net中使用此连接字符串连接到oracle并保持超时获取大的结果集。

如何使用此连接字符串设置更长的连接超时?

static private string GetOracleConnectionString()
{
    return "User Id=USER;Password=pass;Data Source=(DESCRIPTION=" +
            "(ADDRESS=(PROTOCOL=TCP)(HOST=14.12.7.20)(PORT=1139))" +
            "(CONNECT_DATA=(SID=QCTRP1)));";

}

2 个答案:

答案 0 :(得分:9)

return "User Id=USER;Password=pass;Data Source=(DESCRIPTION=" +
            "(ADDRESS=(PROTOCOL=TCP)(HOST=14.12.7.20)(PORT=1139))" +
            "(CONNECT_DATA=(SID=QCTRP1)));Connection Timeout=60;";

有关Oracle Data Provider for .NET / ODP.NET

的更多信息

答案 1 :(得分:4)

你在连接字符串上寻找connection timeout吗?

  

当连接关闭时,   连接池服务确定   连接生命周期是否有   超过了Connection的值   终身属性。如果是这样的话   连接关闭;否则,   连接回到连接   池。   (http://www.connectionstrings.com/oracle)

或者您正在寻找命令项上的CommandTimeout吗?

Specifies the number of seconds the command is allowed to execute before terminating the execution with an exception

我认为对于长时间运行的查询,您需要扩展CommandTimeout属性...但是它默认为0(无限制),因此您可能需要检查