[PyGreSQL] Re: [Zope] PyGres DB Connection in Zope drops when many Usersare added(UserDB)

Stephan Richter srichter at cbu.edu
Wed Apr 26 00:33:37 EDT 2000


>try:
>     try:
>         ob=self.sqlUserQuery(username=name)
>     except:
>         # first get the PyGreSQL connection object
>         conn = getattr(self,self.conn_id)
>         # then "reset" it
>         conn.connect(conn.connection_string)
>         # and retry the query
>         ob=self.sqlUserQuery(username=name)
>except:
>     # failing after reset means a more serius problem (like bad query)
>     return None

I put the extra reconnect code in every method that used the DB connection, 
since you do not know, whether the getUser is accessed first after loosing 
the connection.

Regards,
Stephan
--
Stephan Richter - (901) 573-3308 - srichter at cbu.edu
CBU - Physics & Chemistry; Framework Web - Web Design & Development
PGP Key: 735E C61E 5C64 F430 4F9C 798E DCA2 07E3 E42B 5391





More information about the PyGreSQL mailing list