> rieh25 said the following on 11/16/2006 09:12 PM:
>> I wanted to do it because for some reason, my oracle connector (DCOracle)
>> keeps disconnecting, and so I thought maybe it would be possible to define a
>> python method to periodically check on it and reconnect it if necessary.
>>


> * for various reasons, the connecions get dropped sometimes, and we need
> to catch that and restart the affected node. Hence the scripts.
Do you know these reasons?


Seems to me that your script only checks one opened connection.

Say you have Oracle_database_connection object that is connected to:
xxx/[EMAIL PROTECTED]
When you call context.Oracle_database_connection() (and ZSQLMethods
do that) DCOracle2 checks if there is volatile attribute:
_v_database_connection. If no, then DCOracle2 creates connection to
Oracle and assigns it to _v_database_connection. Finally
_v_database_connection is returned.

Volatile attributes are associated with connections to ZODB. So every
connection to ZODB will have it's own copy of _v_database_connection.

The result is that, you're checking only one, connection to
Oracle (assigned to currently used ZODB connection), and it is possible
that other oracle connections (assigned to different ZODB connections)
are broken.

You may sometimes see the above behaviour by clicking on 'Close' button
in Oracle_database_connection object. After closing you'll see that
connection state is closed. But try hitting refresh in your browser for
a few times. You'll likely see sometimes that connection is 'Open',
because your request will use different connection to ZODB.

As Chris said 'Open/Close' button is almost useless in DCOracle2. It is
good only to check whether connection string is valid.

I have modified version of DCOracle2 that has some errors corrected and
is able to do a reconnect on a broken connections. It displays error
once, and then reconnects. It also uses a kind of pool of connections,
so Open/Close button is working as expected. If you're interested then I
may try to publish this code.

-- 
Maciej Wisniowski
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to