[Zope3-Users] Some hint needed.

Sakesun Roykiattisak sakesun at boonthavorn.com
Fri Jun 3 23:17:25 EDT 2005


>You might want to have a look at SQLOS. See http://codespeak.net/z3/sqlos
>
>  
>

Nahh. I've seen sqlobject before. I just don't like it. In *my* 
object-oriented definition, any OR mapping is highly "un-object-oriented".

>>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.
>
>  
>

Ahh, yes. I've already implement it by just looking at gadfly example. 
Very easy indeed.
However, there are still some little problem. Making connection via 
ADO/OLE DB inside
zope is unreasonably slow (2 minute). I don't know why. But it might be 
something
OLE DB/COM-related rather that zope issue.

By the way, I just wonder who design the zope "dsn" spec ?  I find hard 
time to fit
OLE DB connection string to the spec. The param's value is not allowed 
to be quoted
so that I value can be in form of nesting "param=value". The "parseDSN" 
is too
preliminary.

I now just ignore the spec and use plain OLE DB connection string as the 
dsn value

>>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.
>
>  
>

Yes you are right. After spending sometime with source code, I finally 
manage to understand how things work.

>>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.
>
>  
>

I've also solved this problem with my customized ZopeConnection (zope 
dbi connection wrapper)
that will test the connection and close it if it's broken, whenever the 
transaction was rollback.

>Regards,
>Stephan
>  
>

Thanks.  Your book is just right here. (Weitershausen is in shipping also)



More information about the Zope3-users mailing list