Wrong connection string to reach external database

Hello team,

I have a web service, which is a Java application. I’ve implemented a new functionality that requires a database. This database is not in Render, but in another server.

The connection string is injected into the app via an environment variable DATABASE_CONNECTION and I set a value like jdbc:mysql://lhcp6666.webapps.net/name_of_database. I set this environment variable via the Environments menu in the web service of Render.com

In local all works well but, when I deploy in Render, I get an error like this

15:53:01.568 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
15:53:05.366 [main] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
java.sql.SQLException: Access denied for user 'username_to_connect_to_database'@'ec2-35-157-117-28.eu-central-1.compute.amazonaws.com' (using password: YES)

I don’t know from where that ec2-35-157-117-28.eu-central-1.compute.amazonaws.com comes from. I do not have any server in AWS and, of course, nothing in my code like that.

The thing is that if I set a value differently, like jdbc:mysql://localhost:3306/db the error message is different.

15:51:10.431 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
15:51:13.432 [main] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

Which makes total sense, because there is no database in localhost. With this test, I verified that the environment variable was properly set and propagated into my Java application.

Any idea why my Java application tries to connect to a database server that I do not configure?

Thank you!


It would appear your code is somehow getting an outbound hostname for our Frankfurt region. is one of our Outbound IPs for services in the Frankfurt (eu-central-1) region.

I’m not a Java expert, so I’m unsure why this would happen. Maybe you need to double-check that the DB client code is reading the env var correctly.



So, if I understand correctly, somehow, my code is able to figure out the hostname that targets your Frankfurt region.

To be honest, my code is not prepared to do such a thing :slight_smile:

Is there any other explanation? maybe some routing you have?

I will try to hardcode the host of my database or something. I will keep you posted.

Thank you.

Hello team,

The problem persists. Even if I hardcode the connection string, somehow, it’s redirecting or resolving to your IP. How could be possible that my code is able to target your IP?

Thank you.

It’s going to be something in how you’ve setup your code/service. I’ve not seen this behavior reported before and successfully connecting to external databases is what a huge amount of customers will already be doing.

While general code debugging is beyond the scope of our support, maybe you could share some of the code around your database connection? We could then try and troubleshoot the issue with you.

If you don’t want to share these details on the community forum, please feel free to raise a ticket from the “Help” or “Contact Support” links while logged into the Dashboard.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.