[thelist] Key ID of Record Just Created?

Ken Schaefer Ken at adOpenStatic.com
Mon Aug 29 04:25:47 CDT 2005


: -----Original Message-----
: From: thelist-bounces at lists.evolt.org [mailto:thelist-
: bounces at lists.evolt.org] On Behalf Of VOLKAN ÖZÇELIK
: Subject: Re: [thelist] Key ID of Record Just Created?
: 
: > 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.

There must be some kind of "reset" functionality in Sybase, DB2 and Oracle as
well. As far as the database is concerned, there are only "x" physical
connections - it is completely unaware of the number of connection objects up
in the middle tier. If there was no reset functionality, then if I opened a
new connection in Java or ASP, then I could do a "SELECT @@IDENTITY" straight
away, and get the last inserted identity for that connection (which would
have been generated by the previous user of the connection). By using a
reset, the scope is cleared, and I can't get someone else's identity by
accident.

Cheers
Ken


More information about the thelist mailing list