[Zope-DB] Per-user connections

Bo M. Maryniuck b.maryniuk@forbis.lt
Tue, 10 Dec 2002 13:37:46 +0200

On Monday 09 December 2002 20:37, Dieter Maurer wrote:
> Which respect to the discussion (thread safety), it does not matter
> whether you put the connection itself in a session or an identifier
> for it.

Yes. It could be _very_ cool to put whole connection into the Session -- =
headpain with carefull tracing what connection to use, idiotic pools,=20
timeout/logout machinery, remote crontab scripting etc. But this is does =
work. Unfortunately. But any worse provides some nice side effect: since =
developed all this stuff, I've actually developed user trace: who / when =
from / which IP / why logged in / etc. Well, if you want be crazy -- do i=
perfectly. ;-)

> When you are happy with your solution, that is fine with me.
> However, you should carefully consider thread safety. If you don't,
> you can get non-deterministic failure. This is very difficult to
> analyse...

Difficult to analyse what? You have newly created DB object, which is alr=
connected to the DB -- this is authorisation step. Then you aquire DB=20
instance and use with SQL methods, procedures etc. There is not too hard =
determine which connection to use: just add to its id current session ID.=
timeout-or-logout machinery will care to disconnect / close DB session wh=
it needed to be.=20

Maybe I still missing something?

Regards, Bogdan

"Only wimps use tape backup: _real_ men just upload their important stuff
on ftp, and let the rest of the world mirror it ;)"
(Linus Torvalds, about his failing hard drive on linux.cs.helsinki.fi)