On 3/23/2018 5:19 PM, Phil Steitz wrote:
> That's the documentation for the alternative pool.  Use this instead:
> https://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP)_Configurations

This does not really explain how to configure Tomcat.  It says "go see
the DBCP documentation for parameters you can use."  I do see some
Resource configurationsfurther down on the page ... and they do not have
a "factory" attribute at all.  Is that the difference?

The only resource I have is Tomcat documentation, and whatever nuggets
were *left out* of the Tomcat documentation that I might learn here.  If
this were source code, I could get it all working.  Especially using
DBCP2.  But there's no code for me to modify -- I only have Resource
configurations in tomcat's context.xml file.

Since there doesn't appear to be any documentation for setting it up the
way you think I should be setting it up ... can you guide me to writing
a new configuration?

The config I'm planning has evolved a little bit since the last time I
shared it.  Here's an example of its current state:

        <Resource name="jdbc/REDACTED"
                        auth="Container"
                       
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
                        driverClassName="com.mysql.jdbc.Driver"
                        type="javax.sql.DataSource"
                        maxActive="100"
                        maxIdle="5"
                        minIdle="2"
                        maxAge="7200000"
                        removeAbandoned="true"
                        removeAbandonedTimeout="3600"
                        logAbandoned="true"
                        username="REDACTED"
                        password="REDACTED"
                        testOnBorrow="true"
                        testOnConnect="true"
                        testOnReturn="true"
                        testWhileIdle="true"
                        validationQuery="SELECT 1"
                        validationQueryTimeout="5"
                        validationInterval="5000"
                        minEvictableIdleTimeMillis="900000"
                        allowMultiQueries="false"
                       
url="jdbc:mysql://REDACTED.REDACTED.com:3306/REDACTED?autoReconnect=true&amp;zeroDateTimeBehavior=round"
/>

If you think I should be doing something different, please tell me
exactly what you think I should change, and tell me *why* you think each
of those changes is a good idea.  And then maybe I can discuss
documentation deficiencies with the Tomcat community.


> Yes, that is a borrow.
> There is another, um, "feature" that I forgot to mention in ye olde
> DBCP 1.x.  As documented here
> https://commons.apache.org/proper/commons-dbcp/api-1.4/org/apache/commons/dbcp/BasicDataSource.html#getRemoveAbandoned()
> removal will only happen with your config if there are 57+
> connections out.

That seems like a REALLY bad way to handle it!  Hopefully that's changed
in the newest 1.x and 2.x versions!

Does this affect Tomcat too?  How about the
"org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" that we currently
have configured?  I was planning to use abandonWhenPercentageFull="50",
which is specific to Tomcat.  The property description looks like it
will fix that issue.  I think I'll just leave it out, which the
documentation says will make connections ALWAYS eligible for removal
once they've reached the abandoned timeout.

Thanks,
Shawn


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to