Link to home
Start Free TrialLog in
Avatar of srikotesh
srikotesh

asked on

How do i configure connection pool as common for all applications

Hi Experts,

How do i configure connection pool as common for all applications.
I WANT TO MAKE it as common connection pool for all.

Application 1:
Connectin pool
maximumPoolSize is 20

<bean id="zapidDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
		destroy-method="close">

		<!-- Connection properties -->
		<property name="driverClass" value="com.mysql.jdbc.Driver" />

		<property name="jdbcUrl" value="${zapid.jdbc.url}" />
		<property name="user" value="${zapid.jdbc.username}" />
		<property name="password" value="${zapid.jdbc.password}" />

		<!-- Pool properties -->
		<property name="initialPoolSize" value="0" />

		<property name="minPoolSize" value="${c3p0.minPoolSize}" />

		<property name="maxPoolSize" value="${c3p0.maximumPoolSize}" />

		<!-- In milliseconds -->
		<property name="checkoutTimeout" value="20000" />

		<!-- In seconds -->
		<property name="maxIdleTime" value="300" />

		<!-- In seconds -->
		<property name="maxConnectionAge" value="600" />
		
</bean>

Open in new window


Application 2:
maximumPoolSize is 20

i want to make this connection pool as common for both applications

maximumPoolSize is 40

how do i make changes

is it possible to do changes at tomcat level
Avatar of srikotesh
srikotesh

ASKER

this connection pool configured in spring-config.xml file
under src/main/webapp/webinf folder .
SOLUTION
Avatar of gheist
gheist
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi gheist,

In which file i have to configure this JNDI datasource connection.
http://www.journaldev.com/2905/hibernate-tomcat-jndi-datasource-example-tutorial

i have made changes by using the above link

but hibernate configuration file having issue
http://www.journaldev.com/3531/spring-mvc-hibernate-mysql-integration-crud-example-tutorial

the above link have hibernate config file how do i change it. if i want to use jndi datasource.
Hibernate - what? Maybe you need ODBC, TNS and TDS pooling too?

I am telling you to set per-server JNDI datasource. (pooled by apache or c3p0 or whatever)
i am using spring and hibernate in my project.
so that's why I am refering those links.
I don't know about ODBC.
Neither relates to first question./
this is  related to first question only.
You are configuring c3p0 JDBC pool per application.
You can make JDBC pool using apache commons pool in tomcat (or c3p0 if you like frequent failures)

It really does not matter if client is hibernate or serber is mssql or oracle.
http://www.journaldev.com/2905/hibernate-tomcat-jndi-datasource-example-tutorial

i have made changes by refering the above link.
now I have a problem at application level cfg file.

I don't know how to change this file

please refer journal dev spring mvc project cfg file.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Now you dont have to bundle database drivers with your applications == huge win in space....
i am configured jndi data source connection at server level thru journal dev link

hi gheist,
 thanks for ur help