Results 1 to 2 of 2

Thread: MySql conection pooling in Spring

  1. #1

    Post MySql conection pooling in Spring

    I hv written the following code in mybean.xml(my bean configuration file), pls let me know if it is perfect to implement connection pooloing for MySql Database in my application or if any thing else I need to write instead of this. any suggestion would be highly appreciate.

    CODE==>

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    <bean id="employeeServices" class="com.shrikant.spring.EmployeeServiceImpl">
    <property name="employeeDAO">
    <ref local="empdao"/>
    </property>
    </bean>
    <bean id="empdao" class="com.shrikant.spring.dao.EmployeeDAODBImpl">
    <constructor-arg>
    <ref local="ds"/>
    </constructor-arg>
    </bean>

    <bean id="ds" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost:3306/springdb"/>
    <property name="username" value="root"/>
    <property name="password" value="database"/>
    </bean>




    </beans>

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    Please use [ code][/code ] tags when posting code. To answer your question, which is also answered in the reference guide!, no it isn't. DriverManagerDataSource is not a connection pool. It creates connections when needed and closes them afterwards, if you need a connection pool use something like BoneCP, C3P0 or commons-dbcp (and there are probably others outthere also).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

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