DbManager could not retrive a connection.

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

suvroz
Posts: 12
Joined: 16 Mar 2010, 09:37

DbManager could not retrive a connection.

Postby suvroz » 16 Mar 2010, 09:48

Hi

I am using the below configuration:

<DatabaseManager active="true">
<!--
<Driver>sun.jdbc.odbc.JdbcOdbcDriver</Driver>
<ConnectionString>jdbc:odbc:sfsTest</ConnectionString>

-->

<!-- Example connecting to MySQL -->

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

<ConnectionString>jdbc:mysql://localhost:3306/db24</ConnectionString>
<UserName>XXXXXXX</UserName>
<Password>XXXX</Password>

<TestSQL><![CDATA[SELECT COUNT(*) FROM User]]></TestSQL>

<MaxActive>10</MaxActive>
<MaxIdle>10</MaxIdle>

<OnExhaustedPool>fail</OnExhaustedPool>
<BlockTime>5000</BlockTime>

</DatabaseManager>


All the username, password, port number and database name are tested OK using php test class. However the config.xml is showing the following error:


INFO | jvm 1 | 2010/03/16 06:04:14 | DB Manager Activated ( org.gjt.mm.mysql.Driver )
INFO | jvm 1 | 2010/03/16 06:04:14 | 06:04:14.125 - [ SEVERE ] > DbManager could not retrive a connection. com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 | ** BEGIN NESTED EXCEPTION **
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 | java.net.ConnectException
INFO | jvm 1 | 2010/03/16 06:04:14 | MESSAGE: Connection refused
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 | STACKTRACE:
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 | java.net.ConnectException: Connection refused
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.net.PlainSocketImpl.socketConnect(Native Method)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.net.Socket.connect(Socket.java:519)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.net.Socket.connect(Socket.java:469)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.net.Socket.<init>(Socket.java:366)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.net.Socket.<init>(Socket.java:209)
INFO | jvm 1 | 2010/03/16 06:04:14 | at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
INFO | jvm 1 | 2010/03/16 06:04:14 | at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
INFO | jvm 1 | 2010/03/16 06:04:14 | at com.mysql.jdbc.Connection.createNewIO(Connection.java:2744)
INFO | jvm 1 | 2010/03/16 06:04:14 | at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
INFO | jvm 1 | 2010/03/16 06:04:14 | at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.sql.DriverManager.getConnection(DriverManager.java:582)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.sql.DriverManager.getConnection(DriverManager.java:185)
INFO | jvm 1 | 2010/03/16 06:04:14 | at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:48)
INFO | jvm 1 | 2010/03/16 06:04:14 | at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
INFO | jvm 1 | 2010/03/16 06:04:14 | at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:771)
INFO | jvm 1 | 2010/03/16 06:04:14 | at org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:175)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.sql.DriverManager.getConnection(DriverManager.java:582)
INFO | jvm 1 | 2010/03/16 06:04:14 | at java.sql.DriverManager.getConnection(DriverManager.java:207)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.db.DbManager.executeQuery(DbManager.java:270)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.db.DbManager.executeQuery(DbManager.java:248)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.SmartFoxServer.setupZone(SmartFoxServer.java:1840)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.lib.ConfigReader.parse_Zones(ConfigReader.java:806)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigReader.java:174)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:339)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:607)
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 | ** END NESTED EXCEPTION **
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 | Last packet sent to the server was 0 ms ago.
INFO | jvm 1 | 2010/03/16 06:04:14 | it.gotoandplay.smartfoxserver.exceptions.DbManagerException: The Test SQL statement failed! Please check your configuration.
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.SmartFoxServer.setupZone(SmartFoxServer.java:1843)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.lib.ConfigReader.parse_Zones(ConfigReader.java:806)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigReader.java:174)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:339)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:607)
INFO | jvm 1 | 2010/03/16 06:04:14 | Problems in config file: The Test SQL statement failed! Please check your configuration.
INFO | jvm 1 | 2010/03/16 06:04:14 | it.gotoandplay.smartfoxserver.exceptions.ConfigurationException: The Test SQL statement failed! Please check your configuration.
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigReader.java:199)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:339)
INFO | jvm 1 | 2010/03/16 06:04:14 | at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:607)
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 | Errors found in configuration files.
INFO | jvm 1 | 2010/03/16 06:04:14 | Unable to start the server.
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 |
INFO | jvm 1 | 2010/03/16 06:04:14 | Shutting down server...
INFO | jvm 1 | 2010/03/16 06:04:14 |
STATUS | wrapper | 2010/03/16 06:04:16 | <-- Wrapper Stopped

Regards,
Suvrajit
User avatar
Lapo
Site Admin
Posts: 21726
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 16 Mar 2010, 17:36

Something is not allowing the connection. Looks like it is a network problem.
If SFS runs on the same machine where the database runs there shouldn't be such problem.
Also I would expect MySQL server to be listening on the localhost, right?

I am clueless at the moment. I could suggest to try a different version of the JDBC connector as a last resort.
Lapo
--
gotoAndPlay()
...addicted to flash games
mrpinc
Posts: 25
Joined: 02 Nov 2009, 21:12

Postby mrpinc » 16 Mar 2010, 18:06

MySQL does not allow remote connections by default. You can change this easily in PHPMyAdmin.

Also it looks like you are using 2 different driver types :

sun.jdbc.odbc.JdbcOdbcDriver
and
org.gjt.mm.mysql.Driver

I am not sure if this could mess something up or not, maybe smartfox only allows 1 database driver?

Also the connection string for the JdbcOdbcDriver looks odd to me :

jdbc:odbc:sfsTest

But I am not familiar with that database type so I very well could be the one who is wrong on that.
suvroz
Posts: 12
Joined: 16 Mar 2010, 09:37

Postby suvroz » 17 Mar 2010, 09:32

It is working now!

what i did?
I unblocked port 3306 for public. It was only open to internal server requests.

But here another question arises, both SFS and MySql are residing on the same server, so how does opening of the port to public help?

Anyway, Problem resolved temporarily...
User avatar
Lapo
Site Admin
Posts: 21726
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 17 Mar 2010, 17:00

I have no idea. It looks like it's more of a system/db issue than an SFS one :)
Lapo

--

gotoAndPlay()

...addicted to flash games
suvroz
Posts: 12
Joined: 16 Mar 2010, 09:37

Postby suvroz » 18 Mar 2010, 05:37

Lapo wrote:I have no idea. It looks like it's more of a system/db issue than an SFS one :)


Yeh! Good to see such a lively forum anyway!

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 24 guests