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?
Please sign in to leave a comment.
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.
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
This error message seems to confirm my theory.
I just turn my windows firewall off and it is still doing the same :(
That is the server side setting, most likely.
If the same if I try to connect to a msql database created just for that project in my intellij idea
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.
The server is allowing external connection, but anything is happening
So, you can telnet <server_ip> 3306 and it connects from your system?
yes i can, can telnet and can use the database from my webserver, but not in my intelliJ local server
If you can't telnet from the local server, the issue is not with IntelliJ IDEA, but with your server configuration.
I can telnet from anywhere buddy :/
Attach the screenshot with telnet command that works from IDEA machine and JDBC URL you are using on the same system.