0

this is my application .properties file

server.context-path=/moneymonster
management.security.enabled=false

#spring.datasource.url=jdbc:mysql://localhost:3306/money_monster?zeroDateTimeBehavior=convertToNull&createDatabaseIfNotExist=true
spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=projej30521
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.username=
spring.datasource.password=

#Jpa
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect

#batch
spring.batch.job.enabled=false

#security.user.password=password

#jsp
spring.mvc.view.prefix: /view/
spring.mvc.view.suffix: .jsp

the application.propeties file consist of configuration of hibernate and jpa and sql server 12 configuration

2 Answers 2

1
spring.datasource.username= "you must set username"

if you have password you must set it

and this example

spring.datasource.url=jdbc:sqlserver://localhost;databaseName=springbootdb
spring.datasource.username=sa
spring.datasource.password=Projects@123
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.jpa.hibernate.ddl-auto = create-drop
Sign up to request clarification or add additional context in comments.

1 Comment

thanks for the answer i will make sure to check that and come back to you with an update or an issue
1

You do not have any username/password for logging in to the db in your properties file.

You can make a new user and it's password and create the corresponding db in your local machine if not exists.

For creating new user, login as root credential to mysql and type:

CREATE USER 'newuser' IDENTIFIED BY 'password';

replace the newuser and password accordingly.

Don't forget to grant privilege to the user, given you want to give this user all privileges on that specific database:

GRANT ALL PRIVILEGES ON dbname . * TO 'newuser';

Add the username and the password in your application.properties file. Or, if you have username and password, then just edit the properties file accordingly.

2 Comments

thanks for the answer i will make sure to check that and come back to you with an update
@AmanRSingh, if it answers your query, please consider accepting it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.