2

I have declared db url, db user and db password in application.properties like this

spring.datasource.url=${SPRING_DB_URL}
spring.datasource.username=${SPRING_DB_USER}
spring.datasource.password=${SPRING_DB_PASS}

This works in Ubuntu 16.04 but it is not working in windows 7, and the web application is not starting and in logs, it is showing,

Driver com.microsoft.sqlserver.jdbc.SqlServerDriver claims not to accept jdbcurl, ${SPRING_DB_URL}

I tried setting the environment variable with key like this, spring_datasource_url but that too is not working.

the app is build as war file

Why this works in Ubuntu but not in Windows 7?

4
  • How do you run your app ? Maven, ide or jar ? Commented Jul 20, 2019 at 13:17
  • why don't you use SPRING_DB_URL as key? Commented Jul 20, 2019 at 13:21
  • @MartinChoraine, it is a war file and deployed using tomcat manager Commented Jul 20, 2019 at 13:31
  • @Deadpool that is what i initialy tried Commented Jul 20, 2019 at 13:32

1 Answer 1

2

From Externalized Configuration So use the key in upper case letters with combination of underscore if needed

If you use environment variables rather than system properties, most operating systems disallow period-separated key names, but you can use underscores instead (for example, SPRING_CONFIG_NAME instead of spring.config.name).

Sign up to request clarification or add additional context in comments.

3 Comments

so you are saying that I should use SPRING_DATASOURCE_URL
Yes i believe, give a chance @Sony
Little late here I did all the above then restarted my IDE (Intellij) worked great

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.