tags:

views:

269

answers:

1

hi friend, I have created the application in which I need to configure the connection pool.In which I am configuring the connection pooling in the spring_Config file. using the Basicdatasource. but there is some problem to create the connection pool. Please tell me how to create the connection pooling in spring application using BasicDatasource.

I tried this one code in spring config ;-

bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource"> com.mysql.jdbc.Driver jdbc:mysql:/revup?noAccessToProcedureBodies=true jdbc:mysql://localhost:3306/revup?noAccessToProcedureBodies=true--> --> -->

    <property name="poolPreparedStatements">
    <value>true</value>
    </property>
     <property name="initialSize">
        <value>2</value>
    </property>

    <property name="maxActive">
        <value>15</value>
    </property>

Is there any modification of code please tell me. thanks in advance.

+1  A: 

Here's a working example:

<bean id="dataSourceApache" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="url" value="jdbc:mysql://localhost:3306/coffee_shop" />
    <property name="username" value="john" />
    <property name="password" value="secret" />
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
</bean>

If you're using Eclipse, you should also download support for XML configuration syntax. It really helps you alot.

SpringSource Tool Suite has all the SpringSource support bundled ready for use.

Else, you can see all the fields that's possible to set in the Java documentation.

Espen