You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Barbara Baughman <ba...@utdallas.edu> on 2001/10/01 19:02:09 UTC

Re: Connection Pooling

To the bigger question of accessing the init method from Velocity Servlet,
you can write your own loadConfiguration() method as indicated in the
Velocity documentation.  The Velocity Servlet init() method always calls
the loadConfiguration() method.  Whether it's a good idea to create
connections here is up to you. 

Barbara Baughman
X2157

On Fri, 28 Sep 2001, Rasoul Hajikhani wrote:

> Hi,
> I was reading "Core Servlets..." and at some point the author recommends
> that it is best to create connections inside the init method of the
> servlets. In extending VelocityServlet I do not have access to the init
> method of my servlet(?). I am wondering what is the work around to that? 
> Appreciate all comments and suggestions
> -r
> 


Re: Connection Pooling

Posted by Nick Bauman <ni...@cortexity.com>.
Database access is best abstracted through some kind of O/R mapping, which
usually has some kind of connection pooling. I wrote a simple O/R layer
which fits most of my needs that uses java.sql.DataSource - based
connection-pooling. It could be a bit more flexible than it is, but at that
point I will be looking at Torque / Turbine.

As a side note, people who write tools to iterate over a DB result set in
the Velocity page are sidestepping much of this issue entirely, which is
fine if your app is a toy, intended to be used by maybe you and one other
person only. ;)

> To the bigger question of accessing the init method from Velocity
> Servlet, you can write your own loadConfiguration() method as indicated
> in the Velocity documentation.  The Velocity Servlet init() method
> always calls the loadConfiguration() method.  Whether it's a good idea
> to create connections here is up to you. 
> 
> Barbara Baughman
> X2157
> 
> On Fri, 28 Sep 2001, Rasoul Hajikhani wrote:
> 
>> Hi,
>> I was reading "Core Servlets..." and at some point the author
>> recommends that it is best to create connections inside the init
>> method of the servlets. In extending VelocityServlet I do not have
>> access to the init method of my servlet(?). I am wondering what is the
>> work around to that?  Appreciate all comments and suggestions
>> -r
>> 


-- 
Will America never be the same after September 11? I would phrase the
question differently. Will America again be so captured by fear as to cast a
net of suspicion over growing numbers of its own citizens?