CommandTimeout doesn't happen with ODP.NET 10.1.0.4.0
448873Aug 2 2005 — edited Feb 8 2012Hi, Guys.
I have a problem. I'm using ODP.NET 10.1.0.4.0, and trying to generate an exception by CommandTimeout. I set CommandTimeout 1 second and executed a query that takes a few minutes. But nothing happend.
I know that MS's System.Data.OracleClient doesn't support CommandTimeout but ODP.Net does from 10.1.0.3.01.
Is there anyone who can solve this problem?
Here is a code.
OracleConnection conn = new OracleConnection("Data Source=foo;user id=foo;password=bar");
OracleCommand cmd = conn.CreateCommand();
cmd.CommandTimeout = 1;
cmd.CommandText="SELECT foo FROM baz_tbl WHERE hoge = 'ZZZ'";
OracleDataAdapter adapt = new OracleDataAdapter(cmd);
DataSet ds = new DataSet();
try {
Console.WriteLine(DateTime.Now.ToString());
adapt.Fill(ds);
Console.WriteLine(DateTime.Now.ToString());
} catch (Exception ex) {
Console.WriteLine("Exception: " + ex.Message);
Console.WriteLine(DateTime.Now.ToString());
}
--------------------
and output was just bellow
2005/08/02 16:12:50
2005/08/02 16:13:48