I have just completed a Spring Boot tutorial of 34 videos. Im looking online and everything seems to show me how to create persistence of my data when the spring application is running. However, once I stop the program and restart it, it doesn’t have the data I want saved.
So what it sounds like is I need to store this information on a database. I think I’ve set up a MySql server on my laptop and I have the workbench app/interface.
What might be more appropriate is connecting to an online server that I have with phpmyAdmin. In any case, how do I connect my spring application to a database instead of to a localhost:8080
Please let me know where I can look and what resources I have here as I’m kind of new to this sort of thing. Much appreciated!
2
Answers
There 2 options
spring.jpa.hibernate.ddl-auto=create-drop
hibernate property that will recreate db schema every time you start the application – thus its “clear” of the start. Use update or validate instead.Maybe you can set
spring.sql.init.mode=never
to not always initialize your database using scripts.This way you’ll find all data you saved even when re-run the app.