开发者

how to make connection pool in spring application using BasicDataSource

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

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

    <prope开发者_如何学Gorty name="maxActive">
        <value>15</value>
    </property>

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜