[Zope-dev] Re: Per-user Oracle connections (fwd)
Oleg Broytmann
phd@phd.russ.ru
Mon, 31 Jan 2000 10:45:22 +0000 (GMT)
Hi!
Nobody seems able to answer, trying to repost...
On Tue, 18 Jan 2000, Jim Fulton wrote:
> > I have an Oracle database, and by design every user that logs into the
> > site will be connected to the DB with his/her login/password (that is,
> > his/her Oracle login/password is the same as for WWW).
> >
> > I am considering using Zope for the site, but the question is - how can
> > I create one ZOracleDA connection for every user, and how can I use diferent
> > connections for different users?
>
> You can't. However, you could create a new kind of connection
> object that did this for you. This should be a reasonably
> straightforward hack of ZOracleDA:
>
> - Take a database name through the web.
Not a database name - it's fixed - but login/password. Well, I can do
it, but how can I pass this information to Connection object?
Well, recently I read the code for Postgres, MySQL and Oracle adapters,
and a lot of code in lib/python/Shared/DC/ZRDB, so I thing I do understand
what is Connection object, adapter and so on.`
It seems I need to write a Connection object based on
Shared.DC.ZRDB.THUNK.THUNKED_TM or Shared.DC.ZRDB.THUNK.TM, maintain a pool
of actual database connections, and pass queries down to
db_connection.query(). But how can I find the db_connection? It is an
object from my pool of connection, but I need to know 2 things:
1) login/password; I thing the pool will be just a dictionary indexed by
(login, password) tuples. Does this information available in the query()
method?
I can stuff login/password into a REQUEST object, but is the REQUEST
object available in the query() ?
2) whether the connection is actually running a query; if the query is
in the process - I need to open new connection for the same user. How do I
ask the connection object "Are you running a query"?
Oleg.
----
Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru
Programmers don't die, they just GOSUB without RETURN.