You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Ferrer, Eric" <er...@transcore.com> on 2006/09/19 23:21:22 UTC

OJB-DBCP initial connection pool setting support

Hi,

 

DBCP supports an initialSize property for initializing connections on
startup, does OJB support this parameter?

 

Thanks

-Eric

 

 

Disclaimer: 
This email may contain confidential and privileged material for the sole use of the intended recipient(s) and only for those purposes previously or herein authorized by the sender. Any review, use, distribution or disclosure by others, or use by the recipient for unauthorized purposes, is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.

RE: OJB-DBCP initial connection pool setting support

Posted by "Ferrer, Eric" <er...@transcore.com>.
Sure Armin,

http://jakarta.apache.org/commons/dbcp/configuration.html

parameter initialSize added since 1.2 version of jar.

I am trying to setup a case where x connections are in the pool per
number of users, setup the maxActive to expected load, setup some
eviction threads and test that after peak usage increase our connection
pools to maxActive threshold, that when eviction threads run, we come
back down to our original pool settings.  

I may have to use JBoss to accomplish this, but my code base supports
Tomcat and Jboss in production using DBCP and I would like to keep this
the same.

Thanks
-Eric

-----Original Message-----
From: Armin Waibel [mailto:arminw@apache.org] 
Sent: Thursday, September 21, 2006 1:30 PM
To: OJB Users List
Subject: Re: OJB-DBCP initial connection pool setting support

Hi Eric,

Ferrer, Eric wrote:
> Hi,
> 
>  
> 
> DBCP supports an initialSize property for initializing connections on
> startup, does OJB support this parameter?
> 

A DBCP property 'initialSize' is not supported. Could you point me at 
the DBCP doc-section describe this property?

regards,
Armin


>  
> 
> Thanks
> 
> -Eric
> 
>  
> 
>  
> 
> Disclaimer: 
> This email may contain confidential and privileged material for the
sole use of the intended recipient(s) and only for those purposes
previously or herein authorized by the sender. Any review, use,
distribution or disclosure by others, or use by the recipient for
unauthorized purposes, is strictly prohibited. If you are not the
intended recipient (or authorized to receive for the recipient), please
contact the sender by reply email and delete all copies of this message.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org

Disclaimer: 
This email may contain confidential and privileged material for the sole use of the intended recipient(s) and only for those purposes previously or herein authorized by the sender. Any review, use, distribution or disclosure by others, or use by the recipient for unauthorized purposes, is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OJB-DBCP initial connection pool setting support

Posted by Armin Waibel <ar...@apache.org>.
Hi Eric,

Ferrer, Eric wrote:
> Armin,
> 
> I was just following up on this questions regarding being able to set
> the initial size of the pool on DBCP via the OJB.properties.  
> 
> If this can not be done in the current release, is there a plan to make
> it available or is there a work around?
> 

Yep, I'm working on this stuff (check in tomorrow).
A workaround could be to extend ConnectionFactoryDBCPImpl and to 
implement this behavior by overriding method setupPool (see below), 
declare the class in OJB.properties and using a custom-attribute 
"initialSize" within connection-pool element in repository file.
http://db.apache.org/ojb/docu/guides/repository.html#custom+attribute


> Could this be accomplished by switching from DBCP to JBOSS?  I have
> never used JBOSS connection pooling with OJB and would like to know if
> this has been tested and if there are any examples on how to configure
> OJB with JBOSS?
> 

I only use JBoss Datasources in managed environments (JTA). But I think 
it's possible to setup a JBoss connection-pool without JTA (but I never 
tried this).

regards,
Armin

###########
Workaround:
###########
public class ConnectionFactoryDBCPExtImpl extends ConnectionFactoryDBCPImpl
{
     private Logger log = 
LoggerFactory.getLogger(ConnectionFactoryDBCPImpl.class);

     protected ObjectPool setupPool(JdbcConnectionDescriptor jcd)
     {
         ObjectPool pool = super.setupPool(jcd);
         String initialSizeStr = 
jcd.getConnectionPoolDescriptor().getAttribute("initialSize", null);
         if(initialSizeStr != null && initialSizeStr.length() > 0)
         {
             int initialSize = Integer.parseInt(initialSizeStr);
             if(initialSize > 0)
             {
                 try
                 {
                     for (int i = 0 ; i < initialSize ; i++)
                     {
                         pool.addObject();
                     }
                 }
                 catch (Exception e)
                 {
                     log.error("Error preloading the connection pool 
(initialSize=" + initialSize + ")", e);
                 }
             }
         }
         return pool;
     }
}


> Thank you
> -Eric
> 
> -----Original Message-----
> From: Armin Waibel [mailto:arminw@apache.org] 
> Sent: Thursday, September 21, 2006 1:30 PM
> To: OJB Users List
> Subject: Re: OJB-DBCP initial connection pool setting support
> 
> Hi Eric,
> 
> Ferrer, Eric wrote:
>> Hi,
>>
>>  
>>
>> DBCP supports an initialSize property for initializing connections on
>> startup, does OJB support this parameter?
>>
> 
> A DBCP property 'initialSize' is not supported. Could you point me at 
> the DBCP doc-section describe this property?
> 
> regards,
> Armin
> 
> 
>>  
>>
>> Thanks
>>
>> -Eric
>>
>>  
>>
>>  
>>
>> Disclaimer: 
>> This email may contain confidential and privileged material for the
> sole use of the intended recipient(s) and only for those purposes
> previously or herein authorized by the sender. Any review, use,
> distribution or disclosure by others, or use by the recipient for
> unauthorized purposes, is strictly prohibited. If you are not the
> intended recipient (or authorized to receive for the recipient), please
> contact the sender by reply email and delete all copies of this message.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> Disclaimer: 
> This email may contain confidential and privileged material for the sole use of the intended recipient(s) and only for those purposes previously or herein authorized by the sender. Any review, use, distribution or disclosure by others, or use by the recipient for unauthorized purposes, is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


RE: OJB-DBCP initial connection pool setting support

Posted by "Ferrer, Eric" <er...@transcore.com>.
Armin,

I was just following up on this questions regarding being able to set
the initial size of the pool on DBCP via the OJB.properties.  

If this can not be done in the current release, is there a plan to make
it available or is there a work around?

Could this be accomplished by switching from DBCP to JBOSS?  I have
never used JBOSS connection pooling with OJB and would like to know if
this has been tested and if there are any examples on how to configure
OJB with JBOSS?

Thank you
-Eric

-----Original Message-----
From: Armin Waibel [mailto:arminw@apache.org] 
Sent: Thursday, September 21, 2006 1:30 PM
To: OJB Users List
Subject: Re: OJB-DBCP initial connection pool setting support

Hi Eric,

Ferrer, Eric wrote:
> Hi,
> 
>  
> 
> DBCP supports an initialSize property for initializing connections on
> startup, does OJB support this parameter?
> 

A DBCP property 'initialSize' is not supported. Could you point me at 
the DBCP doc-section describe this property?

regards,
Armin


>  
> 
> Thanks
> 
> -Eric
> 
>  
> 
>  
> 
> Disclaimer: 
> This email may contain confidential and privileged material for the
sole use of the intended recipient(s) and only for those purposes
previously or herein authorized by the sender. Any review, use,
distribution or disclosure by others, or use by the recipient for
unauthorized purposes, is strictly prohibited. If you are not the
intended recipient (or authorized to receive for the recipient), please
contact the sender by reply email and delete all copies of this message.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org

Disclaimer: 
This email may contain confidential and privileged material for the sole use of the intended recipient(s) and only for those purposes previously or herein authorized by the sender. Any review, use, distribution or disclosure by others, or use by the recipient for unauthorized purposes, is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OJB-DBCP initial connection pool setting support

Posted by Armin Waibel <ar...@apache.org>.
Hi Eric,

Ferrer, Eric wrote:
> Hi,
> 
>  
> 
> DBCP supports an initialSize property for initializing connections on
> startup, does OJB support this parameter?
> 

A DBCP property 'initialSize' is not supported. Could you point me at 
the DBCP doc-section describe this property?

regards,
Armin


>  
> 
> Thanks
> 
> -Eric
> 
>  
> 
>  
> 
> Disclaimer: 
> This email may contain confidential and privileged material for the sole use of the intended recipient(s) and only for those purposes previously or herein authorized by the sender. Any review, use, distribution or disclosure by others, or use by the recipient for unauthorized purposes, is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org