[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 -- =
no=20
headpain with carefull tracing what connection to use, idiotic pools,=20
timeout/logout machinery, remote crontab scripting etc. But this is does =
not=20
work. Unfortunately. But any worse provides some nice side effect: since =
I've=20
developed all this stuff, I've actually developed user trace: who / when =
/=20
from / which IP / why logged in / etc. Well, if you want be crazy -- do i=
t=20
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=
eady=20
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 =
to=20
determine which connection to use: just add to its id current session ID.=
 And=20
timeout-or-logout machinery will care to disconnect / close DB session wh=
en=20
it needed to be.=20

Maybe I still missing something?

--=20
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)