kacalapy
kacalapy

Reputation: 10164

Oracle timeouts – how can I set a longer timeout using this connection string?

I am using this connection string in .NET to connect to Oracle and keep timing out getting a large result set.

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)));";

}

Upvotes: 7

Views: 46847

Answers (2)

Harrison
Harrison

Reputation: 9100

are you looking for a connection timeout on 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)

or are you looking for the CommandTimeout on the command item?

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

Upvotes: 5

Conrad Frix
Conrad Frix

Reputation: 52675

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

Upvotes: 13

Related Questions