java JDBC with mysql not connecting from external host.?
I'm playing with java jdbc with mysql, i've had a webserver with mysql installed for awhile. The webserver is running Ubuntu linux.
I'm trying to run a small java program i found somewhere to test the connection to the MySQL db. It will not connect with this error given:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsExce ption: Communications link failure.
But I sshed into my server and installed the jdbc driver and ran that program with localhost and it worked.
here's the line in the program that I tried to use to connect:
String url = "jdbc:mysql://myserversIP:3306/";
How can i narrow down the problem? Could it be the router? not allowing on that port or is the mysql server only allowing connections via localhost if so how do i change that? I created a new user for mysql and set the host to %.
thanks.
|