ODP.net connection pooling explanation...
170052Mar 12 2007 — edited Mar 14 2007Can someone explain to me how this is suppose to work and what I'm suppose to see on the database side. Some brief history, using DAAB 2.0 from the Enterprise Library and after watching what was happening with V$SESSION, I'm confused or something isn't working as it should with connection pooling.
This isn't DAAB code, but it's the same concept and I get the same behavior whether I'm using the DAAB or directly hitting ODP.net as below.
Here is a simple test of what I'm trying...
Dim cn As New OracleConnection
Dim cmd As New OracleCommand
cn.ConnectionString = "<my connectonstring>"
cn.Open()
cmd.Connection = cn
cmd.CommandText = "select SYSDATE from dual"
cmd.ExecuteNonQuery()
cmd.Dispose()
cn.Close()
cn.Dispose()
I run the code above, and after it's complete, the session in V$SESSION remains and never goes away until I close the application completely. It was my understanding that after a .Close, and especially after a .Dispose, the connection should be returned to the pool and then go away completely once the default connection lifetime was reached. I forget what the connect string defaults are on this, but you get the idea.
Is there something on the database side that is not turned on to play nice w/ connection pooling on the client, or something else I'm missing, or am I just not understanding how this should be working.
The end result here is that w/ each call to the DAAB, I'm expecting it to open and close a connection as it needs one, and dispose...all of which seems to be happening in the DAAB. If I inspect my variables, the connection is in fact closed after calls to the DAAB, like .LoadDataSet. But, like I said, when I go look at V$SESSION, the connection remains there as long as my app is open.
Thoughts ?
Chris