Page 1 of 1

Connecting MySQL

Posted: 13 Feb 2008, 14:03
by AJCGames
Hi !

I'm trying to use MySQL with SFS but it does not want to work :(

I made exactly what you say in the doc and in the forum :
- installed Smartfox
- uploaded mysql-connector-java-5.1.5-bin.jar to my_path/jre/lib/ext
- restarted Smartfox

... and of course it didn't work.

So I tried this things :

- Changing my config.xml (each line is a try of course...)

Code: Select all

<Driver>com.mysql.jdbc.Driver</Driver>
<Driver>org.gjt.mm.mysql.Driver</Driver>

Code: Select all

<ConnectionString>jdbc:mysql://127.0.0.1:3306/dbname</ConnectionString>
<ConnectionString>jdbc:mysql://87.215.52.119:3306/dbname</ConnectionString>
<ConnectionString>jdbc:mysql://localhost:3306/dbname</ConnectionString>
- Trying to "link" the driver

Code: Select all

export set CLASSPATH=/usr/smartfox/SFS_PRO_1.6.0/jre/lib/ext/mysql-connector-java-5.1.5-bin.jar:$CLASSPATH
I got less errors than I had but it still does not work...
Here's the error :

Code: Select all

16:24:45.177 - [ INFO ] > Default Buddy List Persister <INITED>
jvm 1    |      DB Manager Activated ( com.mysql.jdbc.Driver )
jvm 1    | 16:24:45.315 - [ SEVERE ] > DbManager could not retrive a connection. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
jvm 1    |
jvm 1    | Last packet sent to the server was 0 ms ago.
jvm 1    | it.gotoandplay.smartfoxserver.exceptions.DbManagerException: The Test SQL statement failed! Please check your configuration.
jvm 1    |      at it.gotoandplay.smartfoxserver.SmartFoxServer.setupZone(SmartFoxServer.java:1830)
jvm 1    |      at it.gotoandplay.smartfoxserver.lib.ConfigReader.parse_Zones(ConfigReader.java:736)
jvm 1    |      at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigReader.java:220)
jvm 1    |      at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:334)
jvm 1    |      at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:588)
jvm 1    | Problems in config file: The Test SQL statement failed! Please check your configuration.
jvm 1    | it.gotoandplay.smartfoxserver.exceptions.ConfigurationException: The Test SQL statement failed! Please check your configuration.
jvm 1    |      at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigReader.java:245)
jvm 1    |      at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:334)
jvm 1    |      at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:588)
jvm 1    |
jvm 1    | Errors found in configuration files.
jvm 1    | Unable to start the server.
jvm 1    | 2008-02-13 16:24:45.317::INFO:  Shutdown hook executing
Concerning my configuration : SFS is running on a Linux server, the same as mysql, informations displayed at sfs startup are :

Code: Select all

jvm 1    | System CPU(s): 2
jvm 1    | VM Max memory: 66 MB
jvm 1    |
jvm 1    | os.name: Linux
jvm 1    | os.arch: i386
jvm 1    | os.version: 2.6.23.16-20080211a
jvm 1    | java.version: 1.6.0_03
jvm 1    | java.vendor: Sun Microsystems Inc.
jvm 1    | java.vendor.url: http://java.sun.com/
jvm 1    | java.vm.specification.version: 1.0
jvm 1    | java.vm.version: 1.6.0_03-b05
jvm 1    | java.vm.vendor: Sun Microsystems Inc.
jvm 1    | java.vm.name: Java HotSpot(TM) Server VM
Of course my TestSQL is correct, my user and password too, verified, reverified and rereverified...

And can't understand why things are not simple, when they have to be...

Can you halp me please ?

Posted: 13 Feb 2008, 15:42
by Lapo
16:24:45.315 - [ SEVERE ] > DbManager could not retrive a connection. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
jvm 1 |
jvm 1 | Last packet sent to the server was 0 ms ago.
This simply means that you have problems "talkin" to the MySQL server.
Does this message show up when the server is booted?

Posted: 13 Feb 2008, 15:47
by AJCGames
What do you mean by "booted" ?

Without trying to connect the database, the servers starts properly.
Trying to connect to the DB, the messages are displayed at startup, and the server shuts down immediately.

Posted: 13 Feb 2008, 16:05
by AJCGames
GOTCHA !

To help those who encouter this problem (everything is fine params / driver / query but no connection), I made this on my.cnf :

#skip-networking <== must be commented
bind-address=127.0.0.1 <== must be active (present and uncommented)

Don't forget to save and reboot the server...

Posted: 04 May 2010, 21:08
by ZIGraham
BUMP!!!!!

This is the most random nonsensical fix I could possibly imagine. I've been trying to connect for AGES off and on between other projects.

This fix must be shouted from the rooftops and added to the manual. How many other lives/jobs could be saved?

Posted: 12 May 2010, 07:51
by p3dro.sola
AJCGames wrote:GOTCHA !

To help those who encouter this problem (everything is fine params / driver / query but no connection), I made this on my.cnf :

#skip-networking <== must be commented
bind-address=127.0.0.1 <== must be active (present and uncommented)

Don't forget to save and reboot the server...
Thanks! saved my ass.

Posted: 26 May 2010, 21:32
by theoverarchitect
What config does this need to be placed in? I'm having the same issue!

Posted: 27 May 2010, 00:10
by p3dro.sola
theoverarchitect wrote:What config does this need to be placed in? I'm having the same issue!
It's in the mysql configuration file.
If you're on unix type (console) :

Code: Select all

locate my.cnf
if you're using a packed distribution (like xampp) then look it up.