Java – H2 console error: No suitable driver found for 08001/0

h2, java, spring, spring-boot

Hello Im having problem with viewing my schema in H2 console Database:

Im using spring boot:

spring.datasource.initialize=truespring.datasource.url=jdbc:h2:~/test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MV_STORE=FALSE;MVCC=FALSEspring.datasource.driverClassName=org.h2.Driverspring.datasource.username=saspring.datasource.password=spring.h2.console.enabled=true

this is my login page:

enter image description here

so what i see inside is standard console view , without my tables and yet my app is working fine.

Best Solution

Usually "Test connection" is working (green line after login form), but connecting does not. This can be caused by handling of headers, which can be caused by filters or security config. For example, I was hit by this twice:

  1. I have same symptoms and problem was caused by usage of logging. Removing dependency helped to get rid of No suitable driver found for 08001/0 message while logging into h2-console:

    <dependency>    <groupId>org.zalando</groupId>    <artifactId>logbook-spring-boot-starter</artifactId></dependency>

I am not sure, if it is bug of given project, or by wrong usage/config.

  1. Configuring OAuth2 does hit me also. I need to exclude h2-console uri from web and also http security. See some info here. See snippets:

    @[email protected]@EnableGlobalMethodSecurity(        securedEnabled = true,        jsr250Enabled = true,        prePostEnabled = true)@RequiredArgsConstructorpublic class SecurityConfig extends WebSecurityConfigurerAdapter {    @Override    public void configure(WebSecurity web) {        web.ignoring().antMatchers("/h2-console/**");    }    @Override    protected void configure(HttpSecurity http) throws Exception {        http                // only part of config is shown here...                .authorizeRequests()                .antMatchers("/",                        "/error",                        "/favicon.ico",                        "/**/*.png",                        "/**/*.gif",                        "/**/*.svg",                        "/**/*.jpg",                        "/**/*.html",                        "/**/*.css",                        "/**/*.js",                        "/h2-console/**")                .permitAll()                .antMatchers("/auth/**", "/oauth2/**").permitAll()                .anyRequest().authenticated()                .and()                .oauth2Login();    }}