Hi Armin,

Could we handle this by defining an interface and allowing users to specify their own 
tester class?  Here is what I am picturing:

=========================
ConnectionValidator.java
=========================
package org.apache.ojb.broker.accesslayer;

public interface ConnectionValidator
{
        public boolean isValid(java.sql.Connection conn);
}


=========================
repository_database.xml
=========================
<jdbc-connection-descriptor jcd-alias="default" driver="org.postgresql.Driver" etc... >

    <connection-pool maxActive="51" testOnBorrow="true" testOnReturn="false" 
removeAbandoned="true">
        <connection-validator 
className="com.mydomain.ojbutils.PostgresConnectionValidator">
            <attribute attribute-name="foo" attribute-value="testvalue1" />
            <attribute attribute-name="bar" attribute-value="testvalue2" />
        </connection-validator>
    </connection-pool>

    <sequence-manager 
className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
        <attribute attribute-name="autoNaming" attribute-value="false" />
    </sequence-manager>
</jdbc-connection-descriptor>

====================================================

Thoughts?

Sincerely yours,
Justis Peters
Oculan Corp.
[EMAIL PROTECTED]


Armin Waibel [EMAIL PROTECTED] wrote:
> Hi Andrew,
> 
> you can use the 'validationQuery' attribute of connection-pool
> element to specify a validation query. This query will be executed
> each time before a connection was delivered by the pool.
> 
> Any proposals to make this more sophisticated are
> welcome.
> 
> regards,
> Armin
> 
> On Fri, 17 Oct 2003 11:20:02 -0400, Clute, Andrew 
> <[EMAIL PROTECTED]> wrote:
> 
> >I apologized in advance for the increase in mail traffic today. I have
> >checked the archives for an answer to this, to no avail.
> >
> >I am seeing, as expected, if our Database has been restarted that any db
> >connections in the pool as becoming invalid. I understand how this is
> >happening -- the connection doesn't realize the socket connection has 
> >been
> >reset, and so it fails to persist any data. I have simulated the 
> >situation,
> >and I can see the connection when it is retrieved from the pool is still
> >marked as active.
> >
> >I am using ConnectionFactoryPooledImpl. What seems odd to me, is it never
> >self-corrects. It looks to me like when the connection failed, it is 
> >still
> >in the pool, and I never get a valid connection.
> >
> >OJB is being used by EJB's sitting in Jboss. I am not using OJB as a
> >deployed EJB, but calling directly. I am also not using a DataSource 
> >inside
> >of Jboss, but instead the connection pool from OJB.
> >
> >It seems to me using the pooled connections, that when the database is
> >restarted, then I have to take down my Jboss server and restart it to
> >refresh the pool. Am I missing something here? Now, I could use no pool, 
> >and
> >then the problem never arises. Would using the DataSource from jBoss and
> >ConnectionFactoryManagedImpl make it better.
> >
> >What should me expectations be for db connections when the database has 
> >been
> >restarted? (Bigger issue here is our SQL Server cluster -- all the
> >connections become invalid when the server fails over to a different
> >server).
> >
> >-Andrew
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to