I was looking into fixing this and have run into a problem. How do we
want to tell the JdbcDataSouce not to perform keep-alive pings?
Currently, we are defaulting to "SELECT 1" if a <keep-alive> node is not
specified. The problem is how to specify that we want to disable it.
The following will all return null for: controller.getChild(
"keep-alive" ).getValue( null );
<pool-controller min="5" max="10"
connection-class="my.overrided.ConnectionClass">
<keep-alive></keep-alive>
</pool-controller>
<pool-controller min="5" max="10"
connection-class="my.overrided.ConnectionClass">
<keep-alive/>
</pool-controller>
<pool-controller min="5" max="10"
connection-class="my.overrided.ConnectionClass"/>
I was thinking of modifying the code so that it looked like this:
String keepAlive;
Configuration keepAliveConf = controller.getChild( "keep-alive", false );
if ( null != keepAliveConf )
{
keepAlive = keepAliveConf.getValue( null );
}
else
{
keepAlive = "SELECT 1";
}
This way, you would get the following results:
<pool-controller min="5" max="10"
connection-class="my.overrided.ConnectionClass">
<keep-alive>CUSTOM QUERY</keep-alive>
</pool-controller>
=> keepAlive = "CUSTOM QUERY"
<pool-controller min="5" max="10"
connection-class="my.overrided.ConnectionClass">
<keep-alive></keep-alive>
</pool-controller>
=> keepAlive = null
<pool-controller min="5" max="10"
connection-class="my.overrided.ConnectionClass">
<keep-alive/>
</pool-controller>
=> keepAlive = null
<pool-controller min="5" max="10"
connection-class="my.overrided.ConnectionClass"/>
=> keepAlive = "SELECT 1"
Another option would be to add an attribute to the pool-controller to
disable pinging
<pool-controller min="5" max="10"
connection-class="my.overrided.ConnectionClass" keep-alive="no"/>
Any opinions. I think that this last option of adding an attribute
would be the least likely to cause problems.
Once this is resolved, I can move on to fix the NPE that Alexander was
encountering.
Thanks
Leif
Alexander \"Stiefel\" M�ller wrote:
>hello,
>
>my update was 2 days ago, for i was setting up eclipse,
>i did a update right now, and the bug in JdbcDataSource is still there:
>
> if (oradb)
> {
> keepAlive = "SELECT 1 FROM DUAL";
>
> if (getLogger().isWarnEnabled())
> {
> getLogger().warn("The oradb attribute is deprecated, please use
>the" +
> "keep-alive element instead.");
> }
> }
> else
> {
> keepAlive = "SELECT 1"; <<<<<<<<<<< you always set this
> }
>
>i see there's a new version of AbstractJdbcConnection, but JdbcConnectionFactory still
>does not allow m_keepAlive to be null:
>
> if ( null != this.m_class )
> {
> try
> {
> Class[] paramTypes = new Class[] { Connection.class, String.class };
> Object[] params = new Object[] { connection, this.m_keepAlive };
>
> Constructor constructor = m_class.getConstructor( paramTypes );
> jdbcConnection = (AbstractJdbcConnection) constructor.newInstance(
>params ); <<< fails with NullPointerException
> }
> catch ( Exception e )
> {
> try
> {
> Class[] paramTypes = new Class[] { Connection.class,
>boolean.class };
> Object[] params = new Object[] { connection, new Boolean(
>this.m_keepAlive.equalsIgnoreCase(JdbcConnectionFactory.ORACLE_KEEPALIVE) ) }; <<<
>this too
>
>
>
>Mit freundlichen Gr��en / Best Regards,
>
>Alexander "Stiefel" M�ller
>Gesch�ftsf�hrer
>
>stiefelnet e-Solver GmbH
>Friedensplatz 4; D-01309 Dresden
>www.stiefelnet.de
>
>fon +49 (0)3 51 - 31 25 41 0
>fax +49 (0)3 51 - 31 25 41 7
>mobil +49 (0)1 71 - 48 10 96 9
>e-mail [EMAIL PROTECTED]
>
>>-----Original Message-----
>>From: Berin Loritsch [mailto:[EMAIL PROTECTED]]
>>Sent: Thursday, January 24, 2002 9:35 PM
>>To: Avalon Developers List
>>Subject: Re: Bug in Excalibur Datasource package
>>
>>
>>Alexander \"Stiefel\" M�ller wrote:
>>
>>>hi all,
>>>
>>>i'm using the excalibur datasource package to access a IBM DB2 database,
>>>which does not support the default <keep-alive> SELECT 1
>>>i did not find any similar in db2 (and for performace reasons) i
>>>
>>removed the <keep-alive> config.
>>
>>>now i got errors during startup, which are "bugs" in some of the files.
>>>somebody may commit this to cvs. i used a cvs-checkout a few days ago.
>>>i subscribed to this list today, so i do not know if this is a
>>>
>>"known bug" (or a feature??)
>>
>>
>>When was the last time you got a snapshot from Avalon Excalibur?
>>
>>The current CVS addressed alot of issues including the one you have here.
>>Let me know if it is still broken.
>>
>>
>>BTW, we are currently renewing effort on releasing Excalibur 4.1 RSN.
>>
>>
>>
>>--
>>
>>"They that give up essential liberty to obtain a little temporary safety
>> deserve neither liberty nor safety."
>> - Benjamin Franklin
>>
>>
>>--
>>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]
>>
>g>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>