What is difference between Oracle session and Oracle Connection Or Both are the same..?

流过昼夜 提交于 2020-01-16 14:41:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!