Feeds:
Posts
Comments

Archive for February, 2014

Add the following Resource to Tomcat context.xml

<Resource name=”jdbc/mydatasource” auth=”Container” type=”com.mchange.v2.c3p0.ComboPooledDataSource”
factory=”org.apache.naming.factory.BeanFactory”
user=”root”
password=”9707034″
jdbcUrl=”jdbc:mysql://localhost:3306/mydatabase?useUnicode=true&amp;characterEncoding=UTF-8″
driverClass=”com.mysql.jdbc.Driver”
minPoolSize=”2″
initialPoolSize=”10″
maxPoolSize=”50″
idleConnectionTestPeriod=”600″
acquireRetryAttempts=”30″/>

Add the following resource-ref to web.xml

<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/mydatasource</res-ref-name>
<res-type>com.mchange.v2.c3p0.ComboPooledDataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

In Spring applicationContext.xml, add jndi-lookup
<beans>
<jee:jndi-lookup id=”dataSource” jndi-name=”java:comp/env/jdbc/mydatasource” />
</beans>

Also you need add xmlns:jee=”http://www.springframework.org/schema/jee”and xsi:schemaLocation=”http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd&#8221;

Read Full Post »