Results 1 to 4 of 4

Thread: How to know size of connection pool?

  1. #1
    Join Date
    Jun 2005
    Posts
    9

    Default How to know size of connection pool?

    ApplicationContext snippet:
    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName">
    <value>org.hsqldb.jdbcDriver</value>
    </property>
    <property name="url">
    <value>jdbc:hsqldb:hsql://localhost/sa</value>
    </property>
    <property name="username">
    <value>sa</value>
    </property>
    <property name="password">
    <value>sa</value>
    </property>
    </bean>
    How to know size of connection pool? Is it possible to specify the size of connection pool?

  2. #2
    Join Date
    Aug 2004
    Posts
    2,715

    Default Re: How to know size of connection pool?

    Quote Originally Posted by borland2004
    How to know size of connection pool? Is it possible to specify the size of connection pool?
    You did not specify a pool, so there is no size. If you want to use connection pooling, you might consider using org.apache.commons.dbcp.BasicDataSource. There you can configure pooling options as well. It can also easily be configured with Spring.

    Regards,
    Andreas

  3. #3
    Join Date
    Jun 2005
    Posts
    9

    Default Re: How to know size of connection pool?

    Quote Originally Posted by Andreas Senft
    You did not specify a pool, so there is no size. If you want to use connection pooling, you might consider using org.apache.commons.dbcp.BasicDataSource. There you can configure pooling options as well. It can also easily be configured with Spring.

    Regards,
    Andreas
    Thank you for your reply. That means i can set up connection pool with hibernate properties in spring, is it correct?

    Sometimes i need to specify connection number in connection pool because of performance.

    Best Regards

  4. #4
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    The connection pool has nothing to do with Hibernate. To configure Hibernate's SessionFactory you need a DataSource. The DataSource itself can (internally) pool connections, such as the one I proposed. Hibernate will benefit from connection pooling, if it's available, but it will not know about it.

    If you use an application server, you can also obtain a preconfigured DataSource from JNDI which uses the application server's connection pool.

    Here is an example for a DBCP datasource configuration. I hope it helps:
    Code:
        <bean id="DataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <property name="driverClassName">
                <value>$&#123;jdbc.driverClassName&#125;</value>
            </property>
            
            <property name="url">
                <value>$&#123;jdbc.url&#125;</value>
            </property>
            
            <property name="username">
                <value>$&#123;jdbc.username&#125;</value>
            </property>
            
            <property name="password">
                <value>$&#123;jdbc.password&#125;</value>
            </property>
    
            <property name="poolPreparedStatements">
                <value>true</value>
            </property>
            
            <property name="initialSize">
                <value>1</value>
            </property>
            
            <property name="maxActive">
                <value>5</value>
            </property>
            
            <property name="maxIdle">
                <value>2</value>
            </property>
        </bean>
    Regards,
    Andreas

Similar Threads

  1. Replies: 2
    Last Post: Nov 22nd, 2006, 01:38 PM
  2. Replies: 2
    Last Post: Aug 18th, 2005, 06:22 AM
  3. Connection pool getting exhausted.
    By vaibhav.gandhi in forum Data
    Replies: 3
    Last Post: Jul 22nd, 2005, 02:37 PM
  4. connection pool question
    By getagrip in forum Data
    Replies: 2
    Last Post: May 25th, 2005, 11:48 AM
  5. Replies: 5
    Last Post: Mar 4th, 2005, 01:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •