a year ago
I've been trying to deploy my springboot application for 3 days now and I keep getting the same error on railway.
I don't know how to fix this error or what else I should do. I've done almost everything but keep getting this error. Can someone help me out please?
I'm gonna attach some pictures that I believe are relevant, let me know if you require anything else to debug this and I'll provide that if I can.
spring.datasource.url=jdbc:mysql:/${MySQL.MYSQLHOST}:${MySQL.MYSQLPORT}/${MySQL.MYSQLDATABASE} spring.datasource.username=${MySQL.MYSQLUSER} spring.datasource.password=${MySQL.MYSQLPASSWORD}
spring.datasource.url=jdbc:mysql:/${MYSQLHOST}:${MYSQLPORT}/${MYSQLDATABASE} spring.datasource.username=${MYSQLUSER} spring.datasource.password=${MYSQLPASSWORD}
I have tried both approaches and it just doesn't wanna connect to the database. I'm always able to connect the database on my local machine but it just refuses to connect when I try to deploy.
Project Id: 10afb000-203e-438d-9108-8ad754e966b6
11 Replies
a year ago
No guarantees, however, you can try reference the MySQL variables directly in your project.
a year ago

a year ago
Under the variables tab of your spring application reference the variables that you need from your MySQL db

I think your solution sort of worked.
I'm not getting the same communication link failure error anymore.
the service still crashed but now I'm having a different SQL error message.
also, I noticed that now there's an arrow connecting backend service with MYSQL Database.
The error message suggests an issue with the SQL state 08S01
I've never seen such error before what should I do?


a year ago
The arrow means that your current service is referencing environment variables to the service the arrow is pointing at.
a year ago
As for the error, I honestly have no idea.
I'm just not sure if the values are being passed to the application.properties or not.
logically it should but do you know any way to confirm that?
a year ago
To confirm it, you could try to read the values in your code and print them out if applicable, however, you usually don't need to do that, since the referenced envs are always passed correctly, at least in my experience.
a year ago
not sure if it's related to the fact that you missed one / after mysql:/
a year ago
because it's probably jdbc:[database_type]://[host]:[port]/[database_name]?[optional_parameters]