On Monday 30 May 2005 23:00, Sakesun Roykiattisak wrote: > I have a large set of database logics in python. All of them are in > similar forms like this: > > >>> inven = Inventory(dbconnection) > >>> inven.getBillOfMaterial(itemId='10020') > [('1134', 12), ('23522', 32)] > > I'm now investigating the best way to to publish them via zope3. > I need some suggestion on these question.
You might want to have a look at SQLOS. See http://codespeak.net/z3/sqlos > 1. How can I get the "dbconection" ? My database is Microsoft SQL > Server. My dbapi is adodbapi. > Should I study gadflyda code and try to implement adodbapida for this ? You need to implement a Database Adapter for adodbapi. See http://svn.zope.org/psycopgda/trunk/ http://svn.zope.org/mysqldbda/trunk/ for examples. It is pretty easy. > 2. Since zope.app.rdb.ZopeDatabaseAdapter is to be used as a local > service, that mean there will be > one instance per thread like other zodb object; is that correct ? Will > the connection be flushed away > after a transaction finished ? If yes, how to avoid that ? No, the connection is kept as far as I can tell. > 3. What I should do in case that sometime my database might be > unavailable, and I want my connection > to be reestablished where it come back. How can I detect those events > and reestablish the connection > when the certain type of exception was raised (like connection closed by > network error) You would have to write special application-level code to handle this. For example, you could try to send a test query to check for the connection. If no response is received, you create a new connection. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training _______________________________________________ Zope3-users mailing list Zope3email@example.com http://mail.zope.org/mailman/listinfo/zope3-users