Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7599291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:37:33+00:00 2026-05-30T22:37:33+00:00

This article suggests Tomcat 7 apps should use a JDBC connection pool instead of

  • 0

This article suggests Tomcat 7 apps should use a JDBC connection pool instead of a commons-dbcp connection pool. However, the latter is the default for a Grails app, and it’s not obvious how to change it.

My guess is that I need to define a Spring bean in resources.groovy that overrides a bean that is normally created by default, but I’ve no idea what this bean should be named or what properties I need to set.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:37:34+00:00Added an answer on May 30, 2026 at 10:37 pm

    The easiest thing to do would probably be to use the jdbc-pool plugin. Since the configuration options for this pool are intentionally very similar to Commons DBCP (they’re documented here) you can use the plugin to define the jar dependency and manage switching the class for you. The plugin hasn’t been updated in a year so it’s a little out of date (the plugin uses version 1.0.9.0 but the latest is 1.0.9.3) so you might want to define the plugin dependency excluding the jar, and add one for the newer version. It’s in the ebr repo, so you’ll need to add that to your BuildConfig.groovy (see the plugin’s version for how he did it).

    There are configuration notes for the pool here and a series of blog posts by the author here.

    If you do want to configure this without using the plugin, add the ebr repo and the jar dependency to BuildConfig.groovy:

    repositories {
       inherits true
       ...
       ebr()
    }
    
    dependencies {
       runtime('org.apache.tomcat:com.springsource.org.apache.tomcat.jdbc:1.0.9.3') {
          transitive = false
       }
    }
    

    and create an override for the dataSource bean in resources.groovy:

    import org.apache.tomcat.jdbc.pool.DataSource
    
    beans = {
    
       dataSource(DataSource) {
          // mandatory
          driverClassName = '${dataSource.driverClassName}'
          username = '${dataSource.username}'
          password = '${dataSource.password}'
          url = '${dataSource.url}'
          // optional
          minEvictableIdleTimeMillis=1800000
          timeBetweenEvictionRunsMillis=1800000
          numTestsPerEvictionRun=3
          testOnBorrow=true
          testWhileIdle=true
          testOnReturn=true
          validationQuery="SELECT 1"
       }
    }
    

    It’s convenient to use single-quoted strings with ${} placeholders to take advantage of Spring’s property placeholder functionality and keep things DRY since you’ve already set the driver and connect info in DataSource.groovy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this article suggests you can use Color c = Color.decode(FF0096); however this understandably throws
This article here suggests to use -XX:+UseParNewGC To enable a parallel young generation GC
This article on MSDN states that you can use as many try catch blocks
My reading of this article suggests that a benefit of ReCAPTCHA is that it
In this article , the author suggests that there is material overhead associated with
I ran into an InvalidProgramException. This article: http://support.microsoft.com/kb/312544/en-us Suggests I run PEVerify.exe, but I
In this article , Dave Ward describes how to use the jQuery plugin jTemplate
I read this article, it suggests (page 1025 last paragraph) that there is a
This article gives a good overview on why structured exception handling is bad. Is
This article describes a way, in C#, to allow the addition of arbitrary value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.