I am not able to get my SpringBoot application linked with a mySQL POD in Openshift v3.
What I did so far:
- Got a basic spring boot application up and running in openshift v3.
- Added a mysql application. The pod is up and running without errors.
Added the datasource configuration in application.properties of my spring boot app:
spring.datasource.url=jdbc:mysql://mysql:3306/${MYSQL_DATABASE}\ spring.datasource.username=${MYSQL_USER} spring.datasource.password=${MYSQL_PASSWORD}
linked spring boot app with mysql db by executing the command:
oc env dc shoppinglist -e MYSQL_USER=dbuser -e MYSQL_PASSWORD=dbpassword -e MYSQL_DATABASE=shoppingdb
deploymentconfig "shoppinglist" updated
However, the spring boot pod is crashing because it cannot access the mysql db with the given user:
2017-12-29 13:35:00.806 ERROR 1 --- [ main]
o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial
connections of pool. java.sql.SQLException: **Access denied for user
''@'172.17.0.7'** (using password: YES)
Somehow, the username is lost. I guess something with my oc env settings is weard? I have no glue...
I do not know what is wrong so far and appreciate any help. Thanks!
application.properties
are expanded. Anyway, runoc debug dc shoppinglist
and at the shell prompt runenv
to verify that the environment variables are passed into the container as first step. – Graham Dumpletonoc debug dc shoppinglist
. Response is:Error from server (NotFound): pods "dc" not found
I am wondering why this does not work, because when I execute oc get all, it returns besides othersdc/shoppinglist
So syntax is correct, isn't it ? – Tomoc debug dc/shoppinglist
. Usually commands will accept single combined argument, or as split values. Maybe that command doesn't for some reason. – Graham Dumpleton