WARN message in startup: [ main] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=org.hsqldb.jdbcDriver was not found, trying direct instantiation.

Founds: HSQLDB registered the JDBC Driver as org.hsqldb.jdbc.JDBCDriver to DriverManager now.

In org.springframework.boot.jdbc.EmbeddedDatabaseConnection, the driver class name is org.hsqldb.jdbcDriver

This maybe the mismatch cause HikariCP cannot get the driver due to below code:

while (drivers.hasMoreElements()) {
            Enumeration<Driver> drivers = DriverManager.getDrivers();
            Driver d = drivers.nextElement();
            if (d.getClass().getName().equals(driverClassName)) { //driverClassName mismatch
               driver = d;
               break;
            }
         }

So we got the WARN message from HikariCP?

Comment From: wilkinsona

Spring Boot will auto-configure a HikariDataSource for you rather than a DriverDataSource. No warning is logged with the former. Can you please share some details of how you've configured the DriverDataSource in the form of a complete yet minimal sample that reproduces the problem? You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

Comment From: nanlei

Hi @wilkinsona, According to the reference documents, only with below dependencies and no any configuration code.

        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <version>2.3.2.RELEASE</version>
        </dependency>

The output when application start like this:

2020-08-13 09:18:08.837  INFO 2034 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-08-13 09:18:08.848  INFO 2034 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-08-13 09:18:08.848  INFO 2034 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.37]
2020-08-13 09:18:08.912  INFO 2034 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-08-13 09:18:08.912  INFO 2034 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 872 ms
2020-08-13 09:18:09.032  INFO 2034 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2020-08-13 09:18:09.037  WARN 2034 --- [           main] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=org.hsqldb.jdbcDriver was not found, trying direct instantiation.
2020-08-13 09:18:09.675  INFO 2034 --- [           main] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 - Driver does not support get/set network timeout for connections. (feature not supported)
2020-08-13 09:18:09.678  INFO 2034 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2020-08-13 09:18:09.907  INFO 2034 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-08-13 09:18:10.257  INFO 2034 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''

With the debug mode, I found the Hikari using the exact driver class name to compare when get the driver. And the WARN message is from Hikari source code.

Comment From: wilkinsona

Thanks, that additional log output is helpful. I can see that you also have a dependency on Tomcat (presumably via spring-boot-starter-web). I can also see that something is using the data source and it's at this point that the warning is logged. That's given enough to reproduce the problem.

Comment From: wilkinsona

DatabaseDriver uses org.hsqldb.jdbc.JDBCDriver so fixing this will also address an inconsistency in our own codebase. We could use DatabaseDriver.HSQLDB.getDriverClassName() when defining EmbeddedDatabaseConnection.HSQL to ensure the two remain in sync in the future.