CreateDatabaseIfNotExist = true does not work in .properties file in maven project

I have a maven project that connects to a database that already exists. however, I wanted to change it so that if the database does not exist yet. he is being created. so I added this additional code ?createDatabaseIfNotExist=trueto this line.

dataSource.url=jdbc:mysql://localhost/rays-database?createDatabaseIfNotExist=true

And I have a lot of errors, so my question is: is there any additional configuration that is missing for use? createDatabaseIfNotExist = true

I also tried adding a port number that did not matter, which I did not expect.

dataSource.url=jdbc:mysql://localhost:3306/rays-database?createDatabaseIfNotExist=true

here is my .properties file:

 dataSource.driverClassName=com.mysql.jdbc.Driver
 dataSource.url=jdbc:mysql://localhost/rays-database?createDatabaseIfNotExist=true
 dataSource.username=root
 dataSource.password=

 hibernate.dialect=org.hibernate.dialect.MySQLDialect
 hibernate.show_sql=true
 hibernate.hbm2ddl.auto=create
+4
source share
1 answer
+2

Source: https://habr.com/ru/post/1610735/


All Articles