Re: [Zope-dev] Prototype Zope mxODBC DA
Question for Christopher Petrilli: because the patches from the Oracle DA are so small, does merging the mxODBC and Oracle DAs into one code base seem feasible?
No, mostly because both are on the cusp of going somewhere else. We will most likely be undertaking a ground-up rewrite of the ODBC driver based purely on the X/Open CLI spec (which is part of SLQ99), which will also be used to talk to DB2. This will not use a DB-API compatible interface for various reasons. Eventually the DCOracle adapter will undergo a similar transition. We need things that the DB-API doesn't provide, nor perhaps should it. We have already had great success with a Sybase adapter done this way (eventually to be released). Chris -- | Christopher Petrilli Python Powered Digital Creations, Inc. | petrilli@digicool.com http://www.digicool.com
Christopher Petrilli writes:
No, mostly because both are on the cusp of going somewhere else. We will most likely be undertaking a ground-up rewrite of the ODBC driver based purely on the X/Open CLI spec (which is part of SLQ99), which will also be used to talk to DB2. This will not use a DB-API compatible interface for various reasons.
OK. Our situation is that I really, *really* want to start using Zope2, but can't without a working DA. Unless the rewritten ODBC driver is going to be available quite soon, I'd like to continue down the path of the hacked ZOracleDA... which means I need to test it some more. Any suggestions on how to check a DA for correctness? The docs for mxODBC states that it's thread-safe, as long you have one connection per thread. So this would mean that the mxODBC DA could be a Level 2 DA, but I'd have to rewrite the code to keep a separate connection for each thread. Any idea how that should be done? -- A.M. Kuchling http://starship.python.net/crew/amk/ Whoever ceases to be a student has never been a student. -- George Iles
Andrew M. Kuchling wrote:
OK. Our situation is that I really, *really* want to start using Zope2, but can't without a working DA. Unless the rewritten ODBC driver is going to be available quite soon, I'd like to continue down the path of the hacked ZOracleDA...
Yeah it won't be too soon, go for it.
which means I need to test it some more. Any suggestions on how to check a DA for correctness?
Your asking *us* about testing procedures? hah!
The docs for mxODBC states that it's thread-safe, as long you have one connection per thread. So this would mean that the mxODBC DA could be a Level 2 DA, but I'd have to rewrite the code to keep a separate connection for each thread. Any idea how that should be done?
Use the TM_THUNKED mixin instead of TM. This will serialize *all* of your database requests across all database adapters at the transaction boundary (the old kludgy SybaseDA does this). Guaranteed to be safe, but not very scalable. The only way I can think of Zope trying to break the one connection per thread rule is if you made two simultaneous queries in the same web request, I doubt that can happen. Chris thinks that in 99% of all use cases this ins't a problem, but I speak for nobody. -Michel
-- A.M. Kuchling http://starship.python.net/crew/amk/ Whoever ceases to be a student has never been a student. -- George Iles
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://www.zope.org/mailman/listinfo/zope-dev
(Related lists - please, no cross posts or HTML encoding!
To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For non-developer, user-level issues, zope@zope.org, http://www.zope.org/mailman/listinfo/zope )
Michel Pelletier writes:
Use the TM_THUNKED mixin instead of TM. This will serialize *all* of your database requests across all database adapters at the transaction boundary (the old kludgy SybaseDA does this). Guaranteed to be safe, but not very scalable. The only way I can think of Zope trying to
This seems too paranoid to me -- across *all* database adapters? (Or do you mean it serializes requests across all DA objects of a given class, or for a single DA object?) The function which opens a connection looks like this: def __init__(self,connection): self.connection=connection # XXX this is really only correct for Solid L = split(connection) connstr = join(L[0:3], ' ') user = L[3] ; password=L[4] db=self.db=self.Database_Connection(connstr, user, password) self.cursor=db.cursor() This is for Oracle, where it's OK to do multiple queries at a time with the same connection. For mxODBC, where that isn't possible, I was thinking that it would be sufficient to just have a dictionary mapping thread IDs to a specific database connection for that thread. Hmm... we're using PCGI. Does PCGI actually support multiple Zope threads? (A quick look through pcgi_publisher.py suggests not, so it might be academic until we start using ZServer.) -- A.M. Kuchling http://starship.python.net/crew/amk/ Capax is dead. There is no doubt of that. There is nothing in his space but darkness and cold and silence. -- Delirum checks on their quarry, in SANDMAN #44: "Brief Lives:4"
participants (3)
-
Andrew M. Kuchling -
Christopher Petrilli -
Michel Pelletier