DbManager could not retrive a connection. java.sql.SQLExcept

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
ChaseDoggy
Posts: 8
Joined: 20 Jun 2007, 16:11

DbManager could not retrive a connection. java.sql.SQLExcept

Post by ChaseDoggy »

I've been trying to make the following work:

SmartFoxServer PRO version 1.5.5

java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Server VM (build 1.5.0_11-b03, mixed mode)

MySQL version: 5.0.45-community

Trying to connect with:
mysql-connector-java-5.0.7-bin.jar

Using the following connection string:

<DatabaseManager active="true">

<Driver>org.gjt.mm.mysql.Driver</Driver>
<ConnectionString>jdbc:mysql://x.x.x.x/sBase</ConnectionString>

<UserName>xxxxxx</UserName>
<Password>xxxxxx</Password>

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

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

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

</DatabaseManager>


When I set:

DatabaseManager active="false"

The server will start up normally.



I receive the following error when trying to start SFS:

DB Manager Activated ( org.gjt.mm.mysql.Driver )
jvm 1 | Can't load db driver: org.gjt.mm.mysql.Driver
jvm 1 | 19:01:02.062 - [ SEVERE ] > DbManager could not retrive a connection. java.sql.SQLException: No suitable driver
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:1808)
jvm 1 | at it.gotoandplay.smartfoxserver.lib.ConfigReader.parse_Zones(ConfigReader.java:697)
jvm 1 | at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigReader.java:288)
jvm 1 | at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:362)
jvm 1 | at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:611)
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:313)
jvm 1 | at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:362)
jvm 1 | at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:611)



Can anyone help?

Thanks
Willem
Posts: 51
Joined: 26 Jul 2007, 15:43
Location: Netherlands

Post by Willem »

What happens if you change the driver to

Code: Select all

<Driver>com.mysql.jdbc.Driver</Driver>
ChaseDoggy
Posts: 8
Joined: 20 Jun 2007, 16:11

Post by ChaseDoggy »

Unfortunately, same message:

jvm 1 | DB Manager Activated ( com.mysql.jdbc.Driver )
jvm 1 | Can't load db driver: com.mysql.jdbc.Driver
jvm 1 | 10:26:22.220 - [ SEVERE ] > DbManager could not retrive a connection. java.sql.SQLException: No suitable driver
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:1808)
jvm 1 | at it.gotoandplay.smartfoxserver.lib.ConfigReader.parse_Zones(ConfigReader.java:697)
jvm 1 | at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigReader.java:288)
jvm 1 | at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:362)
jvm 1 | at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:611)
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:313)
jvm 1 | at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:362)
jvm 1 | at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:611)
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

How did you install the driver? Did you add it in the lib/ext/ folder of your JRE?
Lapo
--
gotoAndPlay()
...addicted to flash games
ChaseDoggy
Posts: 8
Joined: 20 Jun 2007, 16:11

Post by ChaseDoggy »

Yes I put it in there then I added the following to my /etc/profile

export set CLASSPATH=/usr/local/java/java/lib/ext/mysql-connector-java-5.0.7-bin.jar:$CLASSPATH
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

You seem to be running linux/unix
The Linux version of SFS comes with its own JRE ... if you are running the server with ./sfs you should make sure you install the driver in the embedded JRE
Lapo
--
gotoAndPlay()
...addicted to flash games
ChaseDoggy
Posts: 8
Joined: 20 Jun 2007, 16:11

Post by ChaseDoggy »

I added the classpath element to /*YOUR_PATH*/SFS_PRO_1.5.5/Server/conf/wraper.conf

And it all worked out great.

Thanks for all your help!
harry
Posts: 3
Joined: 21 Apr 2010, 03:57

Post by harry »

I have the same problem:

Code: Select all

--- [ Zones & Rooms ] -------------------------------------

        DB Manager Activated ( com.mysql.jdbc.Driver )
Can't load db driver: com.mysql.jdbc.Driver
04:15:27.300 - [ SEVERE ] > DbManager could not retrive a connection. java.sql.SQLException: Configuration file not found
it.gotoandplay.smartfoxserver.exceptions.DbManagerException: The Test SQL statement failed! Please check your configuration.
        at it.gotoandplay.smartfoxserver.SmartFoxServer.setupZone(SmartFoxServer.java:1843)
        at it.gotoandplay.smartfoxserver.lib.ConfigReader.parse_Zones(ConfigReader.java:806)
        at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigReader.java:174)
        at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:339)
        at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:607)
Problems in config file: The Test SQL statement failed! Please check your configuration.
it.gotoandplay.smartfoxserver.exceptions.ConfigurationException: The Test SQL statement failed! Please check your configuration.
        at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigReader.java:199)
        at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:339)
        at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:607)

Errors found in configuration files.
Unable to start the server.
mysql-connector-java-5.1.12-bin.jar is installed into SmartFoxServer_PRO_1.6.6/jre/lib/ext/ but is not working, can you help?

I also updated SmartFoxServer_PRO_1.6.6/Server/conf/wrapper.conf with a new classpath:

wrapper.java.classpath.41=/*path to*/SmartFoxServer_PRO_1.6.6/jre/lib/ext/mysql-connector-java-5.1.12-bin.jar

What am I doing wrong?

p.s.
I'm running on joyent accelerator: SunOS 5.11 snv_121 i86pc i386 i86pc,
SmartFoxServer 1.6.6 64-bit + Tanuki Java Service Wrapper 3.4.0 64-bit Community edition for Solaris x86
harry
Posts: 3
Joined: 21 Apr 2010, 03:57

Post by harry »

This manual rules:
http://forums.smartfoxserver.com/viewtopic.php?t=1878
:)

I've updated SmartFoxServer_PRO_1.6.6/Server/start.sh with /*path to*/SmartFoxServer_PRO_1.6.6/jre/lib/ext/mysql-connector-java-5.1.12-bin.jar

and it works now! Thank you.
julifos
Posts: 33
Joined: 10 Oct 2009, 23:33
Contact:

Post by julifos »

OK, can you explain this for dummies?

This is my error log:

Code: Select all

|::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::|
|                                                            |
|              ...:::  SmartFoxServer :::...                 |
|                Multiplayer Socket Server                   |
|                      version 1.6.6                         |
|                           ---                              |
|              (c) 2004 - 2009 gotoAndPlay()                 |
|                  www.smartfoxserver.com                    |
|                    www.gotoandplay.it                      |
|                                                            |
|::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::|

::::::::::: { BlueBox INITED } ::::::::::::
:                                         :
: Version 1.0.5 -- (c) 2008 gotoAndPlay() :
:                                         :
:::::::::::::::::::::::::::::::::::::::::::
20:40:23.763 - [ INFO ] > Starting h2 engine...


--- [ System Info ] ------------------------------------------

System CPU(s): 4
VM Max memory: 129 MB

os.name: Mac OS X
os.arch: x86_64
os.version: 10.6.3
java.version: 1.6.0_20
java.vendor: Apple Inc.
java.vendor.url: http://www.apple.com/
java.vm.specification.version: 1.0
java.vm.version: 16.3-b01-279
java.vm.vendor: Apple Inc.
java.vm.name: Java HotSpot(TM) 64-Bit Server VM


--- [ Network Cards ] -----------------------------------------

Card:en5
 -> 10.37.129.2
 -> fe80:0:0:0:21c:42ff:fe00:9%8
Card:en4
 -> 10.211.55.2
 -> fe80:0:0:0:21c:42ff:fe00:8%7
Card:en0
 -> 192.168.0.10
 -> fe80:0:0:0:217:f2ff:fe0c:f91e%4
Card:lo0
 -> 127.0.0.1
 -> fdf0:507:8fe9:5e5c:217:f2ff:fe0c:f91e
 -> fe80:0:0:0:0:0:0:1%1
 -> 0:0:0:0:0:0:0:1


--- [ Licence Loaded ] ------------------------------------

License Type 	-> PRO
License Owner 	-> --== Free Demo Licence ==--
Max. Clients 	-> 20
BlueBox Type 	-> Demo Version

--- [ Zones & Rooms ] -------------------------------------

	DB Manager Activated ( org.gjt.mm.mysql.Driver )
Can't load db driver: org.gjt.mm.mysql.Driver
20:40:24.839 - [ SEVERE ] > DbManager could not retrive a connection. java.sql.SQLException: Configuration file not found
it.gotoandplay.smartfoxserver.exceptions.DbManagerException: The Test SQL statement failed! Please check your configuration.
	at it.gotoandplay.smartfoxserver.SmartFoxServer.setupZone(SmartFoxServer.java:1843)
	at it.gotoandplay.smartfoxserver.lib.ConfigReader.parse_Zones(ConfigReader.java:806)
	at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigReader.java:174)
	at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:339)
	at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:607)
Problems in config file: The Test SQL statement failed! Please check your configuration.
it.gotoandplay.smartfoxserver.exceptions.ConfigurationException: The Test SQL statement failed! Please check your configuration.
	at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigReader.java:199)
	at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFoxServer.java:339)
	at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:607)

Errors found in configuration files.
Unable to start the server.


Shutting down server...
I'm using this in the config file:

Code: Select all

				<Driver>org.gjt.mm.mysql.Driver</Driver>
				<ConnectionString>jdbc:mysql://localhost:3306/qilania</ConnectionString>
And I'm running MySQL thru MAMP at port 3306.

I have this file:

Code: Select all

/Applications/Utilities/mysql-connector-java-5.1.10-bin.jar
But I'm not sure when or how I installed this (if I did it at all!).

I also tried replacing with "com.mysql.jdbc.Driver", but no go.

So, what should I modify/add/whatever?

Thanks in advance!
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Lapo
--
gotoAndPlay()
...addicted to flash games
julifos
Posts: 33
Joined: 10 Oct 2009, 23:33
Contact:

Post by julifos »

I followed all the steps and finally my issue was that by default MAMP doesn't allow external connections to MySQL. After unchecking "Allow local access only" in the MySQL tab, it worked like a charm...

Cheers!
pmilbourne
Posts: 5
Joined: 20 Oct 2010, 15:00

Post by pmilbourne »

@Julifos

Where is that setting "Allow local..." located. Which version of MAMP? Please be as descriptive as possible.

Thanks
julifos
Posts: 33
Joined: 10 Oct 2009, 23:33
Contact:

Post by julifos »

Post Reply