OCI invalid handle error
Posted: Fri 14 Jan 2011 10:27
We have recently decided to upgrade from an old version of your component to the latest release and are seeing some "OCI invalid handle" error messages that we were not previously getting. We are using oracle 10g and version 10.2 of the oracle client.
I have managed to reproduce the issue with the following piece of code:
The problem sesms to go away if o2 is disposed before o3 is created, but in our application the sequence of events is much more compllicated and it would not be easy for us to make changes to work around this issue.
I hope you can help.
Thanks
Darren
I have managed to reproduce the issue with the following piece of code:
Code: Select all
private void button11_Click(object sender, EventArgs e)
{
OracleConnection oc = new OracleConnection();
oc.ConnectionString = "pooling = false";
oc.Unicode = true;
oc.Direct = false;
oc.Server = "development";
oc.UserId = "system";
oc.Password = "manager";
oc.Open();
OracleCommand o2 = new OracleCommand();
o2.ParameterCheck = true;
o2.Connection = oc;
o2.CommandType = CommandType.Text;
o2.CommandText = "SELECT dummy FROM dual";
o2.Prepare();
OracleCommand o3 = new OracleCommand();
o3.ParameterCheck = true;
o3.Connection = oc;
o3.CommandType = CommandType.Text;
o3.CommandText = "SELECT * FROM dual";
o3.Prepare();
o2.Dispose();
o2 = null;
//disconnect
oc.Close();
//reconnect
oc.Open();
//update query
o3.CommandText = "SELECT dummy FROM dual where rownum=1";
o3.Prepare();
}
I hope you can help.
Thanks
Darren