Search This Blog

Friday, September 21, 2018

[HDGEM] How to connect Spring Boot Application to database

Spring Boot gives you defaults on all things, the default in database is H2, so when you want to change this and use any other database you must define the connection attributes in the application.properties file.

Example:
In the sources folder, you create a resource file src/main/resources/application.properties
spring.jpa.hibernate.ddl-auto=create  spring.datasource.url=jdbc:mysql://localhost:3306/db_example  spring.datasource.username=springuser  spring.datasource.password=ThePassword


--
Posted By Blogger to HDGEM at 5/29/2017 01:41:00 PM