As far as I know, there is no (supported) way to do this.
There are other ways around it, however. For instance, you can keep a
list of the database connections that are open in the current context,
and when you get rid of the context, just go through that list and
close them.
I ran into a similar problem with files; although the memory and the
handle to the file would be destroyed by the operating system, the
stream's "flush" command would not be called, and as such, the output
would be incomplete. I rigged up an auto-deleter that basically
allowed me to say:
//on object creation
autoDestroy(theObject);
//on object deletion
cancelAutoDestroy(theObject);
The auto deleter would then be triggered when the program exited.
Alex
Alex Iskander
Web and Marketing
TPSi