#799 sql::SqlErr: Communications link failure

tactics Mon 19 Oct 2009

I am trying to set up Fan on my remote server. I almost have it working, but I'm having issues with MySQL. I have my database set up. The MySQL user is set up for it. I can log in with the mysql command-line client. But when I run a simple test.fan file:

using sql

class Test
{ 
  Void main()
  {
    s := SqlService("jdbc:mysql://localhost:3306/PostTalent",
        "PostTalent",
        "password1").open
  }
}

I get this mess. I'm not sure where to begin investigating. Any ideas?

EDIT: I've seen a hundred threads saying "try adding ?autoReconect=true to the end of the JDBC connection string." I've tried and this doesn't help it.

sql::SqlErr: Communications link failure

Last packet sent to the server was 0 ms ago.
  sql::ConnectionPeer.err (ConnectionPeer.java:298)
  sql::ConnectionPeer.open (ConnectionPeer.java:42)
  sql::Connection.open (Connection.fan)
  sql::SqlService.open (SqlService.fan:57)
  test_0::Test.main (/usr/home/lay-lang/postTalent/test.fan:9)
  sun.reflect.NativeMethodAccessorImpl.invoke0 (Unknown)
  sun.reflect.NativeMethodAccessorImpl.invoke (Unknown)
  sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown)
  java.lang.reflect.Method.invoke (Unknown)
  fan.sys.Method.invoke (Method.java:536)
  fan.sys.Method$MethodFunc.callOn (Method.java:214)
  fan.sys.Method.callOn (Method.java:148)
  fanx.tools.Fan.callMain (Fan.java:138)
  fanx.tools.Fan.executeFile (Fan.java:89)
  fanx.tools.Fan.execute (Fan.java:35)
  fanx.tools.Fan.run (Fan.java:241)
  fanx.tools.Fan.main (Fan.java:279)
Cause:
  sys::Err: com.mysql.jdbc.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.
    com.mysql.jdbc.SQLError.createCommunicationsException (SQLError.java:1070)
    com.mysql.jdbc.ConnectionImpl.createNewIO (ConnectionImpl.java:2103)
    com.mysql.jdbc.ConnectionImpl.<init> (ConnectionImpl.java:718)
    com.mysql.jdbc.ConnectionImpl.getInstance (ConnectionImpl.java:298)
    com.mysql.jdbc.NonRegisteringDriver.connect (NonRegisteringDriver.java:282)
    java.sql.DriverManager.getConnection (Unknown)
    java.sql.DriverManager.getConnection (Unknown)
    sql::ConnectionPeer.open (ConnectionPeer.java:36)
    sql::Connection.open (Connection.fan)
    sql::SqlService.open (SqlService.fan:57)
    test_0::Test.main (/usr/home/lay-lang/postTalent/test.fan:9)
    sun.reflect.NativeMethodAccessorImpl.invoke0 (Unknown)
    sun.reflect.NativeMethodAccessorImpl.invoke (Unknown)
    sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown)
    java.lang.reflect.Method.invoke (Unknown)
    fan.sys.Method.invoke (Method.java:536)
    fan.sys.Method$MethodFunc.callOn (Method.java:214)
    fan.sys.Method.callOn (Method.java:148)
    fanx.tools.Fan.callMain (Fan.java:138)
    fanx.tools.Fan.executeFile (Fan.java:89)
    4 More...

andy Mon 19 Oct 2009

Never saw anything like when I wrote Sidewalk. But not sure if it was just a typo when you posted, but autoReconect is missing a n?

tactics Mon 19 Oct 2009

Whoops, that's a copy & paste error. I did not misspell it on the server.

brian Tue 20 Oct 2009

I don't think that really has anything to do with Fan - sounds like a MySQL problem.

Did you try in Java? I would expect you'd get the same error.

tactics Tue 20 Oct 2009

Good point. I'll try it in Java.

tactics Tue 20 Oct 2009

It was indeed a MySQL configuration issue. Or rather, several issues that worked against me. What crummy defaults my ISP provided.

KevinKelley Tue 20 Oct 2009

I am trying to set up Fan on my remote server.

How's that working out? I'm running a little test server on this machine now, but want to move it to a hosted account soon. What's your basic setup, and does it work more or less like you'd expect?

tactics Tue 20 Oct 2009

It's not too bad. All I had to do was

  • download and install Fan
  • download the MySQL jdbc driver
  • copy my database
  • fix the poorly-chosen defaults for MySQL
  • configure a reverse proxy to locahost:8080 for Wisp
  • compile my app's pod
  • nohup fan <pod>

And it works.

Login or Signup to reply.