What is wrong in my jdbc config pool? I am using clearDB with max_connections plan being 40.

This is my jdbc pool configuration:

&lt;bean
   id="dataSource"
   class="org.apache.tomcat.jdbc.pool.DataSource"
   destroy-method="close"

   p:driverClassName="com.mysql.jdbc.Driver"
   p:url="#{ @dbUrl.getJdbc() }"
   p:username="#{ @dbUrl.getUser() }"
   p:password="#{ @dbUrl.getPassword() }"
   p:initialSize="2"
   p:maxActive="10"
   p:maxIdle="5"
   p:minIdle="2"
   p:maxWait="60000"
   p:timeBetweenEvictionRunsMillis="5000"
   p:minEvictableIdleTimeMillis="60000"
   p:testOnBorrow="true"
   p:validationQuery="/* ping */ SELECT 1"
   p:validationInterval="30000"
   p:testWhileIdle="true"
  /&gt;


Today we had 197 concurrent users on site and received a lot of 


  com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: User 'yyyyy' has exceeded the 'max_user_connections' resource (current value: 40)


which meant that other users were not able to log in and use the site.

It was very frustrating. Might it be because of our maxActive being only 10? What you would propose to refine for this configuration in order to get rid of these error?
Go into my.cnf (or my.ini).  Increase (or set) max_user_connections in the [mysqld] section.

Also check max_connections; the 197 may be bumping up against that.

Do you really have a single user connecting more than 40 times?  Or is the "connection pooling" inflating things?