Can not connect to remote mysql database

Answered

 Hey, I have a remote database in a mysql server, but when I try to run the code, it seems like if isnt connecting to anywhere. But as soom as I upload the project to my webserver it works perfectly. It's like the IJ server can't search for that mysql server :( Can someone help me please?

0
14 comments

Are you sure that the web host permits the remote connections to the SQL server? It could be that the server is configured to accept only local connections, hence it works from the web server and not from the machine where you run the IDE.

You may need to change the server or firewall configuration to accept the connections from your machine.

0
Avatar
Permanently deleted user

This is the error that I'm receiving when I try to run it,

 

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. java.net.ConnectException: Connection refused: connect

0

This error message seems to confirm my theory.

0
Avatar
Permanently deleted user

I just turn my windows firewall off and it is still doing the same :(

0

That is the server side setting, most likely.

0
Avatar
Permanently deleted user

If the same if I try to connect to a msql database created just for that project in my intellij idea

0

You need to provide more details about the machine where MySQL server is running. my.cnf file with the configuration, server OS, whether MySQL port is open for remote connections on the server firewall, etc.

0
Avatar
Permanently deleted user

The server is allowing external connection, but anything is happening 

0

So, you can telnet <server_ip> 3306 and it connects from your system?

0
Avatar
Permanently deleted user

yes i can, can telnet and can use the database from my webserver, but not in my intelliJ local server

 

0

If you can't telnet from the local server, the issue is not with IntelliJ IDEA, but with your server configuration.

0
Avatar
Permanently deleted user

I can telnet from anywhere buddy :/

0

Attach the screenshot with telnet command that works from IDEA machine and JDBC URL you are using on the same system.

0

Please sign in to leave a comment.