• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

make a data base with H2 spring boot

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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 .
 
Ranch Hand
Posts: 1772
12
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!