Reputation:
I have dynamic dashboard and every 3 seconds gets 20 query from oracle to c# winforms.
Currently I use like below;
OracleConnection con = new OracleConnection(oradb);
con.Open();
OracleCommand cmd1 = new OracleCommand(getSystime, con);
OracleDataReader dr1 = cmd1.ExecuteReader();
dr1.Read();
.
.
.
.
.
.
OracleCommand cmd15 = new OracleCommand(getSqltime, con);
OracleDataReader dr15 = cmd15.ExecuteReader();
dr15.Read();
con.Dispose();
con.Close();
Currently when i check, The application has 9 inactive sessions and there are almost 100 open cursor about it. The numbers are not increasing. Even if i check after 1 hour, there are 9 active/inactive and almost 100 open_cursor from my application.
This will be my first application and so i don't have any experience on it.
How can i interpret it ?
Upvotes: 1
Views: 112
Reputation: 59436
You should always Close()
the OracleDataReader
after you have read the content. And surround it by using {}
as it implements IDisposable
using ( OracleConnection con = new OracleConnection(oradb) ) {
con.Open();
OracleCommand cmd1 = new OracleCommand(getSystime, con);
using ( OracleDataReader dr1 = cmd1.ExecuteReader() ) {
dr1.Read();
...
dr1.Close();
}
}
Upvotes: 2
Reputation: 354
Not sure I understand your question but Try using
OracleDataAdapter
instead of
OracleDataReader
My understanding is that DataReader is faster than DataAdapter, but DataReader works in connected mode. DataAdapter/DataSet works in disconnected mode.
This could be the reason you're not getting your queries after a certain amount of time.
Upvotes: 0