I have setup databaselink in my Mathemtica 10 to connect to MySQL database to store results of data analysis
connecting to databse locally(hosted on the same iMAC Yosemite) works using:
conn = OpenSQLConnection[
JDBC["MySQL(Connector/J)", "127.0.0.1:3306/nameofdatabase"],
"Username" -> "usename", "Password" -> "password"];
Then I can retrieve,insert and execute mysql commands directly from mathematica.
Now I am trying to do the same for a MySQL database hosted on a server at specific IP address. I have created a username there with hostname '%' so it accepts connections from any host. I have tested that I am able to connect to the remote MySQL database from command line over ssh and it works. I can also connect to the database using MySQL pro software directly.
When I try to connect to the remote database using:
conn = OpenSQLConnection[
JDBC["MySQL(Connector/J)", "ipofremotemaachine:3306/nameofdatabase"],
"Username" -> "usename", "Password" -> "password"];
I get :
JDBC::error: 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. >>
$Failed
I have checked:
- I can connect to mysql database remotely over ssh
- I have checked that port 3306 is open at the server as I tested connecting to it
- I have updated the .jar file for the MySQL Connector/J in mathematica to the latest version provided by java
I am trying to understand further and pinpoint why is this happening. So far I suspect the port Mathematica is trying to connect to might be closed at the server, but I am unable to find out which port is this and or to get more traces for what happened when the error occurs? any hint and suggestions appreciated?
thanks -