Spring Boot/H2 Console not showing my table

Spring Boot/H2 Console not showing my table

I ran into the same problem and it took a while to find out why tables were missing. In my case I have changed the jdbc url from jdbc:h2:~/test to jdbc:h2:mem:testdb which is the default h2 database created by spring boot.

Also find comments on spring boot default H2 jdbc connection (and H2 console)

You need to register bean for showing h2 console like:

public ServletRegistrationBean h2servletRegistration() {        
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(new WebServlet());       
        return registrationBean;    

and invoke the H2 console from browser like:


Note: Port number will be port on which your spring boot application is running

Add below lines to application.properties

spring.datasource.driverClassName = org.h2.Driver

Spring Boot/H2 Console not showing my table

Ok so that was silly. When i changed the name of my sql file to schema.sql, it worked…

Leave a Reply

Your email address will not be published. Required fields are marked *