I think it is possible to create a database and tables by the Spring boot web app. If I have a file with mysql queries to make database, tables, for example, sql_table.sql file. How to use generate databases and table on the fly if no exits?
Configure MySQL for Spring Boot ApplicationSpring Boot provides a ready-to-use support for H2 Database. Spring Boot automatically set up in memory H2 database if it detects H2 configurations in the classpath.
To access the Relational Database by using JdbcTemplate in Spring Boot application, we need to add the Spring Boot Starter JDBC dependency in our build configuration file. Then, if you @Autowired the JdbcTemplate class, Spring Boot automatically connects the Database and sets the Datasource for the JdbcTemplate object.
The spring-boot-starter-data-jpa is a starter for using Spring Data JPA with Hibernate. The mysql-connector-java dependency is for the MySQL database driver. The spring-boot-maven-plugin provides Spring Boot support in Maven, allowing us to package executable JAR or WAR archives.
I can create a new database without any SSL warnings by this:-
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto=create
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost/aaa?createDatabaseIfNotExist=true&useSSL=true
spring.datasource.username=root
pring.datasource.password=devv
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With