Brian,

If you use a Tomcat resource reference to initialize your DB pool, be
careful where you put it: the location you place that init reference makes
the difference between YOUR webapp using the hibernate pool and ANY webapp
being able to use your hibernate pool.

Now, since someone posted about a Servlet Context Listener starting up
Hibernate for you, what is wrong with the one given on the hibernate site
under the page title "Tomcat Event listener for Hibernate" at the URL
http://www.hibernate.org/133.html ?

The example code shows how to have the hibernate configuration read.  You
can easily put pool information in your hibernate.cfg.xml file so Hibernate
starts the DB Pool for you.  (I do that)  Additionally, it lists how, should
you need it, to have a DB Pool instance automatically given out when a
session object is created and how to remove it when a session is ended.

Lastly, if you use C3P0, BE VERY CAREFUL if you are using version 0.8.3 of
C3P0 - there is no proper DB Pool shutdown code in Hibernate if the pool is
of that type (I last checked Hibernate 2.1.6's pool shutdown code).
Proxool, EHCache, and various other pool software have code in the db class
shutdown method in as far as I know.  (I had to research this when I had a
memory issue and kept restarting my webapp yet memory usage kept rising and
I kept seeing new DB pools each webapp restart.)

Regards,
David

-----Original Message-----
From: Brian McGovern [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 29, 2005 1:41 PM
To: Struts Users Mailing List
Subject: Struts , hibernate, and DBCP


Im using struts, hibernate and dbcp connection pooling.  Everything works
fine but regarding my connection pool.  It gets intantiated on the first
time I request a connection from the DBCP pool.  I want it to create the
pool when tomcat starts.  I think i can do this with struts, but im not sure
how.  If using struts config for htis is not the answer i;d still like to
know what is.

-thanks

---------------------------------------------------------------------
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