ORACLE 超时 - 如何使用此连接字符串设置更长的超时?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4453808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ORACLE TIMEOUTS - how can i set a longer timeout using this connection string?
提问by kacalapy
i am using this connection string in .net to connect to oracle and keep timing out getting a large result set.
我在 .net 中使用这个连接字符串连接到 oracle 并保持超时以获得大的结果集。
how can i set a longer connection timeout using this connection string?
如何使用此连接字符串设置更长的连接超时?
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)));";
}
回答by Conrad Frix
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;";
More info on Oracle Data Provider for .NET / ODP.NET
回答by Harrison
are you looking for a connection timeouton the connection string?
您是否正在寻找连接字符串上的连接超时?
When a connection is closed, the connection pooling service determines whether the connection lifetime has exceeded the value of the Connection Lifetime attribute. If so, the connection is closed; otherwise, the connection goes back to the connection pool. (http://www.connectionstrings.com/oracle)
当连接关闭时,连接池服务会确定连接生存期是否超过了连接生存期属性的值。如果是,则连接关闭;否则,连接将返回到连接池。(http://www.connectionstrings.com/oracle)
or are you looking for the CommandTimeouton the command item?
或者您正在寻找命令项上的CommandTimeout吗?
Specifies the number of seconds the command is allowed to execute before terminating the execution with an exception
I think for a long running query you will need to extend the CommandTimeout property... however it defaults to 0 (no limit) so you may want to check that
我认为对于长时间运行的查询,您需要扩展 CommandTimeout 属性...但是它默认为 0(无限制),因此您可能需要检查一下