• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

make a data base with H2 spring boot

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody :

i learning spring boot , right now i m  trying to make a database using the spring boot h2 dependency , but the data base does n t show itself in the console as below :
here's the code in  /models/AppUsers.java :



i added also  the dependencies h2 and jpa in maven project :



here s my controller in /controllers/MainController.java/
:


also the cose inside the default file


and finally the view inside the /webapp/WEB-INF/jsp/index.jsp



i tried hard to  show the db in the url /localhost:8080/console , but anything doesn t work , should i add something else in order to  complete the code .
 
Bartender
Posts: 2266
13
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Do you have a main class like this:


Do you have application.properties file under resources directory with these properties as the following?
spring.h2.console.enabled=true
spring.h2.console.path=/console

If you are using embedded h2 database, don't need to specify spring.datasource.url, spring.datasource.driverClassName ...

Try to run the MyApplication class to start spring boot first. And then access http://localhost:8080/console and see.
 
reply
    Bookmark Topic Watch Topic
  • New Topic