https://bz.apache.org/bugzilla/show_bug.cgi?id=68436

            Bug ID: 68436
           Summary: Hide "Not loading a JDBC driver as driverClassName
                    property is null" warning
           Product: Tomcat 10
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: mail...@yahoo.com
  Target Milestone: ------

Unnecessary warning fills up the webapp logging file, this happens every time a
db pool creates a new connection and no classname is given.
>> Not loading a JDBC driver as driverClassName property is null.

Using the same webapp for mysqljar and mariadbjar system may use a
configuration without driverClassName field. Destination tomcat may provide
both or one of jdbc jar files without a webapp developer knowledge.

What is an empty driverClassName="" attribute was given then it's an explicit
choice and Tomcat did not need to write a warning log?

See source code:
https://github.com/apache/tomcat/blob/ed8cc4f3beddbdc7d9634cc287660322804007fd/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java#L292

if (poolProperties.getDriverClassName()==null) {
  //rely on DriverManager
  log.warn("Not loading a JDBC driver as driverClassName property is null.");
} else {...

See contextxml db connection example:
<!-- use mariajdbc if found then mysqljdbc -->
<Resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource" 
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
  initialSize="2" maxActive="300" maxIdle="10" maxWait="30000"
  username="myuser" password="mypwd"
 
url="jdbc:mysql://127.0.0.1:3306/mydb?permitMysqlScheme&amp;useUnicode=true&amp;characterEncoding=utf8"
  validationQuery="SELECT 1" validationInterval="6000"
validationQueryTimeout="10"
  rollbackOnReturn="true" removeAbandoned="true" removeAbandonedTimeout="14400"
logAbandoned="false"
  testOnBorrow="true" maxAge="300000" timeBetweenEvictionRunsMillis="60000"
  defaultTransactionIsolation="READ_COMMITTED"
/>

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to