commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "denixx baykin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DBCP-435) [PATCH] Friendly BasicDataSourceFactory
Date Mon, 16 Feb 2015 20:25:11 GMT

    [ https://issues.apache.org/jira/browse/DBCP-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14323240#comment-14323240
] 

denixx baykin commented on DBCP-435:
------------------------------------

That's good! :)
I think every sysadmin will be thankful for that thing.

> [PATCH] Friendly BasicDataSourceFactory
> ---------------------------------------
>
>                 Key: DBCP-435
>                 URL: https://issues.apache.org/jira/browse/DBCP-435
>             Project: Commons Dbcp
>          Issue Type: Improvement
>    Affects Versions: Nightly Builds
>         Environment: commons-dbcp2, Tomcat 8
>            Reporter: denixx baykin
>              Labels: friendly, patch
>             Fix For: 2.1
>
>         Attachments: commons-dbcp2-friendly-BasicDataSourceFactory.patch
>
>
> I wish to make DBCP2 main component (BasicDataSourceFactory) more friendly.
> This is a component which end user faces in Tomcat, when he tries to configure DataSource
in Tomcat.
> I think factory should help user (in our case it is administrators) to understand, that
he make a mistake in configuration.
> Tested with Tomcat 8 from trunk.
> Properly configured Resource in context.xml or server.xml will leave nothing in logs:
> {code:xml}<Resource name="jdbc/MySql"
>               type="javax.sql.DataSource"
>               validationQuery="SELECT 1"
>               timeBetweenEvictionRunsMillis="30000"
>               maxTotal="20"
>               maxIdle="10"
>               minIdle="1"
>               maxWaitMillis="2000"
>               initialSize="20"
>               removeAbandonedTimeout="60"
> 	      removeAbandonedOnMaintenance="true"
>               logAbandoned="true"
>               minEvictableIdleTimeMillis="30000"
>               username="admin"
>               password="megapassword"
>               driverClassName="com.mysql.jdbc.Driver"
>               url="jdbc:mysql://localhost:3306/new_schema"/>{code}
> But filling something wrong will output warnings to logfiles (stderr and logger):
> {code:xml}<Resource name="jdbc/MySql"
> 	      auth="Container"
> 	      factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"
>               type="javax.sql.DataSource"
>               validationQuery="SELECT 1"
>               validationInterval="30000"
>               timeBetweenEvictionRunsMillis="30000"
>               maxActive="20"
>               maxIdle="10"
>               minIdle="1"
>               maxWait="20000"
>               initialSize="20"
>               removeAbandonedTimeout="60"
> 	      removeAbandoned="true"
>               logAbandoned="true"
>               minEvictableIdleTimeMillis="30000"
>               jmxEnabled="true"
>               jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
>               username="admin"
>               password="megapassword"
>               driverClassName="com.mysql.jdbc.Driver"
>               url="jdbc:mysql://localhost:3306/new_schema"/>{code}
> logfile output:
> {noformat}13-Feb-2015 15:30:44.178 WARNING [main] org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory.getObjectInstance
WARNING! Property maxActive is not used since DBCP2, use maxTotal instead. maxTotal default
value is 8. You have set value of "20" for "maxActive" property
> WARNING! Property removeAbandoned is not used since DBCP2, use one or both of removeAbandonedOnBorrow
or removeAbandonedOnMaintenance instead. Both have default value set to false. You have set
value of "true" for "removeAbandoned" property
> WARNING! Property maxWait is not used in DBCP (it's a Tomcat JDBC pool feature), use
maxWaitMillis instead. maxWaitMillis default value is -1. You have set value of "20000" for
"maxWait" property
> WARNING! Property validationInterval is not used in DBCP, it's a Tomcat JDBC pool feature.
Ignoring. You have set value of "30000" for "validationInterval" property
> WARNING! Property jdbcInterceptors is not used in DBCP, it's a Tomcat JDBC pool feature.
Ignoring. You have set value of "org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
for "jdbcInterceptors" property
> WARNING! Property jmxEnabled is not used in DBCP, it's a Tomcat JDBC pool feature. Ignoring.
You have set value of "true" for "jmxEnabled" property
> INFO. Ignoring unknown property: value of "Container" for "auth" property
> INFO. Ignoring unknown property: value of "org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"
for "factory" property{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message