Home > Software design >  Not able to connect to H2 database in Spring Boot
Not able to connect to H2 database in Spring Boot

Time:08-06

I have the below in my yaml file.I keep getting the below error.how to resolve the below error.I am using latest spring boot version .

org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database "C:/Users/mynname/test" not found, either pre-create it or allow remote database creation (not recommended in secure environments) [90149-214]

I can see the H2 console in http://localhost:8080/h2.But when i click on connect button i get the error.

spring:
  h2:
    console:
      enabled: true
      path: /h2
  datasource:
    url: jdbc:h2:mem:testdb
    username: sa
    password:
    driverClassName: org.h2.Driver
  jpa:
    spring.jpa.database-platform: org.hibernate.dialect.H2Dialect
    hibernate.ddl-auto: create

CodePudding user response:

On the h2 console change the default ur that appears there (jdbc:h2:mem:test) to jdbc:h2:mem:testdb And you should be able to connect

  • Related