Jump to content
  • Advertisement
Sign in to follow this  
EmpireProductions

Mysql troubles

This topic is 3073 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using SmartFox for the server of my game and I am trying to get my login extension running off of a mySQL database.

When I go to get a database connection it's saying that there was a communications failure on handshake.

My Java Server Extension code having to do with the database:

DbManager db = new DbManager("com.mysql.jdbc.Driver","jdbc:mysql://127.0.0.1:3306/test","test","xznf2Rys8PmDuj7D","simpleChat",10,10,"fail",5000);

db.executeCommand("INSERT INTO characters (name) VALUES('Timmy Mellowman')" );

and my log:

2010/07/11 22:37:38.899 - [ SEVERE ] [id: 10] (DbManager.executeCommand): DbManager could not retrive a connection. java.sql.SQLException: Communication failure during handshake. Is there a MySQL server running on 127.0.0.1:3306?

I am using WAMP2 for the mySQL database server which I just upgraded the version of MySQL to 5.1.41

and I should be using mysql-connector-java-5.1.13-bin for the connector.

Heres some more of the log that might be helpful:

22:57:35.614 - [ WARNING ] > Could not retrieve a database connection: java.sql.
SQLException: Communication failure during handshake. Is there a MySQL server ru
nning on 127.0.0.1:3306?
java.sql.SQLException: Communication failure during handshake. Is there a MySQL
server running on 127.0.0.1:3306?
at com.mysql.jdbc.MysqlIO.init(MysqlIO.java:628)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1621)
at com.mysql.jdbc.Connection.connectionInit(Connection.java:901)
at com.mysql.jdbc.Driver.connect(Driver.java:311)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnecti
on(DriverManagerConnectionFactory.java:48)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(Poolable
ConnectionFactory.java:290)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericOb
jectPool.java:771)
at org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:175)

at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at it.gotoandplay.smartfoxserver.db.DbManager.getConnection(DbManager.ja
va:218)
at authentication.SecureLogin.init(SecureLogin.java:30)
at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.createExte
nsion(ExtensionHandler.java:246)
at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.createExte
nsion(ExtensionHandler.java:189)
at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.parse_Exte
nsions(ExtensionHandler.java:649)
at it.gotoandplay.smartfoxserver.SmartFoxServer.setupZone(SmartFoxServer
.java:2085)
at it.gotoandplay.smartfoxserver.lib.ConfigReader.parse_Zones(ConfigRead
er.java:806)
at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigR
eader.java:174)
at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFo
xServer.java:339)
at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:
607)

Share this post


Link to post
Share on other sites
Advertisement
Are you sure your DB is running & listening to that port (sorry, dumb question but had to ask). Also - you might look at the DB server logs, it may have more information

Share this post


Link to post
Share on other sites
Yes I am sure my database is running and it's running on the default port. I have been using phpmyadmin to try and create different users to test.

Heres the mysql log nothing worth noting I don't think but here it is:

100711 22:15:55
Plugin 'FEDERATED' is disabled.
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
100711 22:15:55 InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
100711 22:15:55 InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
100711 22:15:55 InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
100711 22:15:55 InnoDB: Started; log sequence number 0 0
100711 22:15:56
Event Scheduler: Loaded 0 events
100711 22:15:56
wampmysqld: ready for connections.
Version: '5.1.41-community-log' socket: '' port: 3306 MySQL Community Server (GPL)

Share this post


Link to post
Share on other sites
tried using the local address as apposed to the loopback?

Edit:

thinking more...

its failing handshake meaning something is replying with data that isnt to be expected...

The information i've found off a quick search is that you're either running the wrong JDBC or that there's something wrong with the install (and that there's old drivers lying about somewhere)

Share this post


Link to post
Share on other sites
Thanks. Got it working now as a result of you saying that it seemed I had some older versions kicking around. I had forgotten that I had the path to one of the older version in my server's batch file so it was in fact loading the older version instead of the new version. It's all cleared up now though!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!