-
May 24th, 2011, 12:01 AM
#1
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>
-
May 24th, 2011, 01:17 AM
#2
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).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules