问题
I m using the Enterprise lib to connect Oracle Database
class Customer{
private readonly Database _db;
public Customer(){
_db = = DatabaseFactory.CreateDatabase(_userSettings.ConnstringName);
}
.. stuff to use this connection..
}
When I run the application and opens multiple screen now Oracle show multiple session for same Application
Also I tried by changing code as
class Customer{
private readonly Database _db;
public Customer(){
_db = = (_userSettings.GetInstance().GetDatabase);
}
.. stuff to use this connection..
}
*_userSettings is a singleton object*
But same thing happens..?
What's going wrong?
Pls Help
Thanks.
回答1:
There is too little information here to give an answer. We'd need to see more about your connection code. What version of oracle are you using?
What may be happening, is you may not be setting a timeout on your user's session, so that these sessions you keep making are staying active.
回答2:
You need to explicitly close the connection using Close() or use a using block to ensure the unmanaged code is garbage collected properly.
来源:https://stackoverflow.com/questions/5717927/what-is-difference-between-oracle-session-and-oracle-connection-or-both-are-the