开发者

Is Database Connection same as Session?

I'm bit confused about relationship between a

  • Database Open Session
  • Connection pooling

To elaborate, I'开发者_运维百科m using JDBC with Oracle 9i DB and I'm also using a Connection Pool to pool my connections.

What I would like to know is that: When my connections are lying idle in pool, are they associated with any Open Session with database? So If I've 5 connection sitting idle in pool, does that mean there will be 5 corresponding active session Open with my database?


Ok.. I got some answer from other forums:

That depends entirely on the pool implementation. It seems likely they are associated with an open session for a while, and then the sessions are closed if the connections are not used for some time, and reestablished when they're needed again.

Not keeping them open for some amount of time would mean wasting the overhead of establishing connections when requests are coming in rapid-fire. Keeping them open forever would hog limited resources for no good reason. Both of these go against my understanding of the very point of having a connection pool in the first place.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜