Database Connection Pooling with Tomcat
Subject:   Old-fashioned article
Date:   2006-04-27 06:24:15
From:   sorend
I think this article is little behind current pace.

Any modern framework, like eg. Spring or Hibernate comes with this kind of "smart" pooling code.

Full Threads Newest First

Showing messages 1 through 2 of 2.

  • Get away with Spring/Hibernate
    2006-04-27 22:04:13  JasonSherman [View]

    Who liked to program in Spring or Hibernate? If you are still using Spring or planning to use frameworks like Spring or Hibernate, then you make give EB 3.0 a serious thought. After all, nobody likes clumsy XML code. Both, Spring and Hibernate make heavy use of XML documents. Prior to EJB 3.0, delivering container services has never been so easy before.

    With regard to this article, itís targeted towards small to medium size applications which have a small footprint and donít require a heavyweight EJB container. I think we must give some credit to the author, cause towards the end, he does mention about out-of-box connection pooling features available in peculiar J2EE environment. Moreover, there are good numbers of developers who are just happy with a simple servlet container like Tomcat and want to explore more into it.

  • Old-fashioned article
    2006-04-28 07:54:05  Kunal_Jaggi [View]

    Spring's approach for DBCP is no different from obtaining a DataSource from JNDI (or DI pattern) as shown in the following code snippets.

    Spring Code (Enrollment-Config.xml)

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName">

    <property name="url">



    Spring Application Code
    public class StudentEnroller implements EnrollAStudent{
    private Resource resource;
    private BeanFactory factory;
    private DataSource ds;
    private JdbcTemplate jt;

    public StudentEnroller(){
    resource=new ClassPathResource("Enrollment-Config.xml");
    factory=new XmlBeanFactory(resource);

    jt=new JdbcTemplate (ds);

    }catch(Exception e){
    //log the error

    There's nothing earth-shattering here!

    Spring provides a choice though, you can inject dependency rather than looking for it.