Message Boards Message Boards

0
|
2685 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Databaselink fails to connect to remote databases (MySQL)

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 -

POSTED BY: Hassan Hamdoun
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract