How to limit number of connections to a database in spring?

I have a Spring based application, deployed on the Tomcat server. What I need is to limit the maximum number of simultaneous connections to a database. This is data source section from my applicationContext.xml:

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  <property name="driverClassName" value="org.postgresql.Driver" />
  <property name="url" value="..." />
  <property name="username" value="..." />
  <property name="password" value="..." />

I would like to do it on the application level, not with server configuration.


Set the maxActive property on the dataSource.

Need Your Help

Unrecognized command line option “-fno-objc-arc”

objective-c xcode automatic-ref-counting

I had over 200 errors in my Xcode project and found that my problem had to do with ARC being enabled. I followed the advice found here to use the flag -fno-objc-arc. Now I am down to only 7 errors,...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.