After continuing to get invalid connections from my JdbcDataSource
component I dove into the source and found a couple of problems.  My
situation is a good test case because for some reason beyond my control
the database goes down and back up nightly.  When this occurred
JdbcDataSource would not regenerate the connections.  I'll include diffs
of my changes that set things right.

Charles


Index: JdbcDataSource.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/datasource/JdbcDataSource.java,v
retrieving revision 1.13
diff -r1.13 JdbcDataSource.java
145,146c145
< 
<             if (oradb)
---
>             if (keepAlive == null)
148c147,149
<                 keepAlive = "SELECT 1 FROM DUAL";
---
>                 if (oradb)
>                 {
>                     keepAlive = "SELECT 1 FROM DUAL";
150c151,157
<                 if (getLogger().isWarnEnabled())
---
>                     if (getLogger().isWarnEnabled())
>                     {
>                         getLogger().warn("The oradb attribute is deprecated, please 
>use the" +
>                                         "keep-alive element instead.");
>                     }
>                 }
>                 else
152,153c159
<                     getLogger().warn("The oradb attribute is deprecated, please use 
the" +
<                                      "keep-alive element instead.");
---
>                     keepAlive = "SELECT 1";
155,158d160
<             }
<             else
<             {
<                 keepAlive = "SELECT 1";
Index: AbstractJdbcConnection.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/datasource/AbstractJdbcConnection.java,v
retrieving revision 1.5
diff -r1.5 AbstractJdbcConnection.java
66c66
<         if (null != keepAlive && "".equals(keepAlive.trim()))
---
>         if (null != keepAlive && !"".equals(keepAlive.trim()))
127c127
<         if ( System.currentTimeMillis - m_lastUsed
---
>         if ( System.currentTimeMillis() - m_lastUsed

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

Reply via email to