[thelist] Key ID of Record Just Created?

VOLKAN ÖZÇELİK volkan.ozcelik at gmail.com
Mon Aug 29 02:08:41 CDT 2005


> In OLEDB (for ASP) / SQLClient (ASP.NET) world your upper layer is
> handed a stub by the connection pool manager when you instantiate a
> connection object. When actually open the connection, you are given a
> real connection from the pool. Provided you keep using that
> connection, you'll get the correct identity value.

So between Conn.Open and Conn.Close you use the same physical
connection to DB is retained. That is how things go on the java side
as well. As soon as you .close the connection or something out of your
control occurs (a System Exceptin -aka EJB Container Excepion-, an SQL
exception, or a stale connection exception occurs for instance) the
connection immediately returns to pool.

> When you call
> .Close, the connection is returned to the pool, and the pool manager
> calls a function to "reset" the connection, essentially resetting the
> scope of the connection. So that the next time that connection is
> used, the correct identity will be returned.

I'm not sure about the scope and reset part, because I've not tried
MSSQL Server + java combination. Currently I work with Sybase; have
used Oracle & DB2 before.
However, imho, as soon as connection returns to pool it will forget
it's past because it will either be killed (after not being used for
an "Unused Timeout" period) or reclaimed with conn.open() and begin a
brand new life.

Cheers,
Volkan.


More information about the thelist mailing list