Hi, i have a game and i get a error when i change the databaseManager to "true". can someone help me to fix that?

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

Moderators: Lapo, Bax

skywalkers101
Posts: 3
Joined: 13 Apr 2016, 00:32

Hi, i have a game and i get a error when i change the databaseManager to "true". can someone help me to fix that?

Postby skywalkers101 » 13 Sep 2016, 01:14

here is the config.xml


<!--
Zones Configuration.
-->
<Zones>

<Zone name="virtualworld" customLogin="false" buddyList="20">
<Rooms>
<Room name="Lobby" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>

<Extensions>
<extension name="virtualWorld" className="virtualworld.as" type="script" />
</Extensions>

<DatabaseManager active="true">

<Driver>org.gjt.mm.mysql.Driver</Driver>
<ConnectionString>jdbc:mysql://127.0.0.1:3306/flash_virtual_world</ConnectionString>

<UserName>root</UserName>
<Password>root</Password>

<TestSQL><![CDATA[SELECT NOW()]]></TestSQL>

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

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

</DatabaseManager>
</Zone>

<Zone name="simpleChat" uCountUpdate="true" buddyList="20" maxUsers="4000" customLogin="false">
<Rooms>
<Room name="The Hall" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" uCountUpdate="true" />
<Room name="The Kitchen" maxUsers="50" isPrivate="false" isGame="false" isTemp="false" />
<Room name="The Garden" maxUsers="50" isPrivate="false" isTemp="false" />
<Room name="The Bathroom" maxUsers="50" isPrivate="false" isTemp="false" />
<Room name="The Garage" maxUsers="50" isPrivate="false" isTemp="false" />
<Room name="The Living Room" maxUsers="50" isPrivate="true" isTemp="false" pwd="test" />
</Rooms>

<Extensions>
<extension name="json" className="jsonSample.as" type="script" />
</Extensions>

<Moderators status="on">
<Mod name="modName" pwd="modPass" />
</Moderators>
</Zone>

<Zone name="dbZone" customLogin="false" buddyList="20">
<Rooms>
<Room name="MainRoom" maxUsers="10" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>

<Extensions>
<extension name="dbTest" className="dbExtension.as" type="script" />
<extension name="dbTestAdv" className="dbExtensionAdv.as" type="script" />
<extension name="simpleExt" className="simpleExt.as" type="script" />
</Extensions>

<DatabaseManager active="false">

<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://192.168.0.1:3306/sfsTest</ConnectionString>
-->

<UserName>yourname</UserName>
<Password>yourpassword</Password>

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

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

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

</DatabaseManager>
</Zone>

<Zone name="sftris" emptyNames="true">
<Rooms>
<Room name="The Entrance" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>
</Zone>

<Zone name="mazeGame">
<Rooms>
<Room name="The Entrance" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>
</Zone>

<Zone name="loginZone" emptyNames="false" customLogin="true">
<Rooms>
<Room name="The Hall" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>

<Extensions>
<extension name="loginEx" className="loginExample.as" type="script" />
</Extensions>
</Zone>

<Zone name="multiChat">
<Rooms>
<Room name="Main Lobby" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>
</Zone>

<Zone name="yahtzee">
<Rooms>
<Room name="The Entrance" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>
</Zone>

<Zone name="slogin" emptyNames="false" customLogin="true">
<Rooms>
<Room name="The Lobby" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
<Room name="The Garden" maxUsers="50" isPrivate="false" isTemp="false" />
<Room name="The Swimming Pool" maxUsers="50" isPrivate="false" isTemp="false" />
</Rooms>

<Extensions>
<extension name="slogin" className="secureLogin.as" type="script" />
</Extensions>
</Zone>

<Zone name="pixel" uCountUpdate="true" customLogin="true">
<Rooms>
<Room name="The Basement" maxUsers="4" isPrivate="false" isGame="false" isTemp="false" />
</Rooms>

<Extensions>
<extension name="pixel" className="pixelGame.as" type="script" />
<!--
To use the java extension instead of the Actionscript one substitute the above line with this:

<extension name="pixel" className="it.gotoandplay.extensions.examples.PixelGame" type="java" />

-->
</Extensions>
</Zone>

<Zone name="letters">
<Rooms>
<Room name="Main" maxUsers="50" autoJoin="true" />
</Rooms>

<Extensions>
<extension name="Letters" className="Letters.as" type="script" />
</Extensions>
</Zone>

<Zone name="messenger" customLogin="true" buddyList="200">
<MaxBuddyVars>2</MaxBuddyVars>
<Rooms>
<Room name="Main" autoJoin="true" limbo="true"/>
</Rooms>

<Extensions>
<extension name="smsg" className="smartMessenger.as" type="script" />
</Extensions>
</Zone>

<Zone name="imgMan" emptyNames="true">
<AutoReloadExtensions>true</AutoReloadExtensions>
<Rooms>
<Room name="MainLobby" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>

<Extensions>
<extension name="imgman" className="imageManager.as" type="script"></extension>
</Extensions>
</Zone>

<Zone name="bomberman" emptyNames="true">
<Rooms>
<Room name="Lobby" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>
</Zone>

<Zone name="h2dbzone" customLogin="false">
<AutoReloadExtensions>true</AutoReloadExtensions>

<Rooms>
<Room name="Lobby" maxUsers="10" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>

<DatabaseManager active="true">
<Driver>org.h2.Driver</Driver>
<ConnectionString>jdbc:h2:tcp://localhost:9009/examples</ConnectionString>

<UserName>sa</UserName>
<Password></Password>

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

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

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

<Extensions>
<extension name="h2db_ext" className="internalDbDemo.as" type="script" />
</Extensions>
</Zone>

<Zone name="advBuddyList">

<BuddyList active="true">
<size>200</size>
<maxBuddyVariables>5</maxBuddyVariables>
<mode>advanced</mode>

<!-- Apply only for advanced mode -->
<offLineBuddyVariables>true</offLineBuddyVariables>
<permissionTimeOut>10</permissionTimeOut>
<mutualAddBuddy>true</mutualAddBuddy>
<mutualRemoveBuddy>true</mutualRemoveBuddy>
</BuddyList>

<Rooms>
<Room name="Lobby" autoJoin="true" limbo="true" maxUsers="10000"/>
</Rooms>

</Zone>

<Zone name="sloader">

<Rooms>
<Room name="Lobby" autoJoin="true" limbo="true" maxUsers="10000"/>
</Rooms>

<Extensions>
<extension name="loader" className="it.gotoandplay.extensions.examples.SocketFileLoader" type="java" />
</Extensions>

</Zone>

<Zone name="SmartVideoClipPlayer" uCountUpdate="true" maxUsers="50" customLogin="false">
<Rooms>
<Room name="The Lobby" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" uCountUpdate="true" />
</Rooms>

<Extensions>
<extension name="__$RedBox$__" className="com.smartfoxserver.redbox.RedBoxExtension" type="java" />
</Extensions>
</Zone>

<Zone name="SmartMessengerAV" customLogin="true" buddyList="200">
<MaxBuddyVars>2</MaxBuddyVars>
<Rooms>
<Room name="Main" autoJoin="true" limbo="true"/>
</Rooms>

<Extensions>
<extension name="smsg" className="smartMessenger.as" type="script" />
<extension name="__$RedBox$__" className="com.smartfoxserver.redbox.RedBoxExtension" type="java" />
</Extensions>
</Zone>

<Zone name="SmartChatAV" uCountUpdate="true" maxUsers="4000" customLogin="false">
<Rooms>
<Room name="The Hall" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" uCountUpdate="true" />
<Room name="The Kitchen" maxUsers="50" isPrivate="false" isTemp="false" />
<Room name="The Garden" maxUsers="50" isPrivate="false" isTemp="false" />
<Room name="The Bathroom" maxUsers="50" isPrivate="false" isTemp="false" />
<Room name="The Garage" maxUsers="50" isPrivate="false" isTemp="false" />
</Rooms>

<Extensions>
<extension name="__$RedBox$__" className="com.smartfoxserver.redbox.RedBoxExtension" type="java" />
</Extensions>
</Zone>

<Zone name="SmartVideoConference" uCountUpdate="true" maxUsers="4000" customLogin="false">
<Rooms>
<Room name="Conference hall 1" maxUsers="10" isPrivate="false" isTemp="false" autoJoin="true" />
<Room name="Conference hall 2" maxUsers="10" isPrivate="false" isGame="false" isTemp="false" />
<Room name="Conference hall 3" maxUsers="10" isPrivate="false" isGame="false" isTemp="false" />
</Rooms>
</Zone>

<Zone name="openspace" uCountUpdate="true" maxUsers="200" customLogin="false">
<Rooms>
<Room name="Ranch (inside)" maxUsers="50" isPrivate="false" isTemp="false" uCountUpdate="true" />
<Room name="Ranch (outside)" maxUsers="50" isPrivate="false" isTemp="false" uCountUpdate="true" />
<Room name="Slopes area" maxUsers="50" isPrivate="false" isTemp="false" uCountUpdate="true" />
</Rooms>
</Zone>

</Zones>


</SmartFoxConfig>







this is the error




it.gotoandplay.smartfoxserver.exceptions.DbManagerException: The Test SQL statem
ent failed! Please check your configuration.
at it.gotoandplay.smartfoxserver.SmartFoxServer.setupZone(SmartFoxServer
.java:1843)
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)
Problems in config file: The Test SQL statement failed! Please check your config
uration.
it.gotoandplay.smartfoxserver.exceptions.ConfigurationException: The Test SQL st
atement failed! Please check your configuration.
at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigR
eader.java:199)
at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFo
xServer.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 have a Mac computer and I am using smartfoxserver Pro 1.6.6. With My SQL connector and Mamp phpadmin
User avatar
Lapo
Site Admin
Posts: 20217
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Hi, i have a game and i get a error when i change the databaseManager to "true". can someone help me to fix that?

Postby Lapo » 13 Sep 2016, 16:13

The error transcript is incomplete, is cut at the beginning. I would need to see the entire thing.

Are you sure you have followed the instructions for setting up the DB Driver?
http://www.smartfoxserver.com/docs/1x/d ... ection.htm

Also are you sure MySQL in MAMP runs on port 3306? I also run MAMP on Mac and the default port is 8889.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
skywalkers101
Posts: 3
Joined: 13 Apr 2016, 00:32

Re: Hi, i have a game and i get a error when i change the databaseManager to "true". can someone help me to fix that?

Postby skywalkers101 » 14 Sep 2016, 23:14

Hello Lapo,

I have updated to SmartFoxServer 2X and I am still have the same issue with connecting the JRE, JAR, and MAMP to the sever, here is the entire startup that Smartfoxserver 2x gives me...



18:13:20,234 INFO [main] v2.SmartFoxServer - Boot sequence starts...
18:13:20,744 INFO [main] core.SFSEventManager - AnonymousService-1 initialized
18:13:20,770 INFO [main] impl.DefaultFileReplicator - Using "/var/folders/78/xyx9wk8j7nz71_pbns2s51b80000gn/T/vfs_cache" as temporary files store.
18:13:20,829 INFO [main] v2.SmartFoxServer - License loaded:

==========================================
LICENSE DETAILS
------------------------------------------
Type : Community Edition
Max users : 100
==========================================

18:13:20,830 INFO [main] managers.SFSBannedUserStorage - BanUserStorage initialized
18:13:20,842 INFO [main] managers.SFSBannedUserManager - BanUser data loaded: 0 records.
18:13:20,847 INFO [main] v2.SmartFoxServer - Protocol Type is: BINARY
18:13:20,897 INFO [main] config.DefaultConfigLoader - Loading: zones/BasicExamples.zone.xml
18:13:20,995 INFO [main] config.DefaultConfigLoader - Loading: zones/virtualworld.zone.xml
18:13:21,018 INFO [main] managers.SFSZoneManager -

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>> Zone: BasicExamples
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

18:13:21,052 INFO [main] managers.SFSRoomManager - Room created: { Zone: BasicExamples }, [ Room: The Lobby, Id: 0, Group: default, isGame: false ]
18:13:21,052 INFO [main] managers.SFSZoneManager -

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>> Zone: virtualworld
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

18:13:21,324 ERROR [main] db.SFSDBManager - com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
Message: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Description: The DBManager Test SQL failed: SELECT NOW(*)
Please double check your SQL code and make sure that Database server is running.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

18:13:21,331 INFO [main] managers.SFSRoomManager - Room created: { Zone: --=={{{ AdminZone }}}==-- }, [ Room: AdminRoom, Id: 1, Group: default, isGame: false ]
18:13:21,341 INFO [main] core.AdminToolService - AdminTool Service started
18:13:21,380 INFO [SFSWorker:Sys:1] v2.SmartFoxServer - Listening Sockets: { 0.0.0.0:9933, (Tcp) } { 127.0.0.1:9933, (Udp) }
18:13:21,391 INFO [SFSWorker:Sys:1] v2.SmartFoxServer -
_____ _____ _____ ___ __ __
| __| __| __| |_ | | |
|__ | __|__ | | _|- -|
|_____|__| |_____| |___|__|__|
_____ _____ _____ ____ __ __
| __ | __| _ | \| | |
| -| __| | | |_ _|
|__|__|_____|__|__|____/ |_|
[ 2.11.1 ]

18:13:21,391 INFO [SFSWorker:Sys:1] v2.SmartFoxServer - SmartFoxServer 2X (2.11.1) READY!
18:13:22,430 INFO [main] v3.SessionFilter - BlueBox-2X Service (3.0.2) READY.
User avatar
Lapo
Site Admin
Posts: 20217
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Hi, i have a game and i get a error when i change the databaseManager to "true". can someone help me to fix that?

Postby Lapo » 15 Sep 2016, 07:45

Hi,
the test SQL you're using --> SELECT NOW(*)
is incorrect. There is no parameter expected in the NOW() function so the SQL should look like this:

Code: Select all

SELECT NOW()


thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
skywalkers101
Posts: 3
Joined: 13 Apr 2016, 00:32

Re: Hi, i have a game and i get a error when i change the databaseManager to "true". can someone help me to fix that?

Postby skywalkers101 » 17 Sep 2016, 02:12

I change it and this is what happened, same error



21:14:18,135 INFO [main] v2.SmartFoxServer - Boot sequence starts...
21:14:18,821 INFO [main] core.SFSEventManager - AnonymousService-1 initialized
21:14:18,845 INFO [main] impl.DefaultFileReplicator - Using "/var/folders/78/xyx9wk8j7nz71_pbns2s51b80000gn/T/vfs_cache" as temporary files store.
21:14:18,910 INFO [main] v2.SmartFoxServer - License loaded:

==========================================
LICENSE DETAILS
------------------------------------------
Type : Community Edition
Max users : 100
==========================================

21:14:18,911 INFO [main] managers.SFSBannedUserStorage - BanUserStorage initialized
21:14:18,922 INFO [main] managers.SFSBannedUserManager - BanUser data loaded: 0 records.
21:14:18,927 INFO [main] v2.SmartFoxServer - Protocol Type is: BINARY
21:14:18,955 INFO [main] config.DefaultConfigLoader - Loading: zones/BasicExamples.zone.xml
21:14:19,027 INFO [main] config.DefaultConfigLoader - Loading: zones/virtualworld.zone.xml
21:14:19,051 INFO [main] managers.SFSZoneManager -

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>> Zone: BasicExamples
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

21:14:19,083 INFO [main] managers.SFSRoomManager - Room created: { Zone: BasicExamples }, [ Room: The Lobby, Id: 0, Group: default, isGame: false ]
21:14:19,084 INFO [main] managers.SFSZoneManager -

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>> Zone: virtualworld
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

21:14:19,416 ERROR [main] db.SFSDBManager - com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
Message: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Description: The DBManager Test SQL failed: SELECT COUNT()
Please double check your SQL code and make sure that Database server is running.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

21:14:19,426 INFO [main] managers.SFSRoomManager - Room created: { Zone: --=={{{ AdminZone }}}==-- }, [ Room: AdminRoom, Id: 1, Group: default, isGame: false ]
21:14:19,434 INFO [main] core.AdminToolService - AdminTool Service started
21:14:19,476 INFO [SFSWorker:Sys:1] v2.SmartFoxServer - Listening Sockets: { 0.0.0.0:9933, (Tcp) } { 127.0.0.1:9933, (Udp) }
21:14:19,502 INFO [SFSWorker:Sys:1] v2.SmartFoxServer -
_____ _____ _____ ___ __ __
| __| __| __| |_ | | |
|__ | __|__ | | _|- -|
|_____|__| |_____| |___|__|__|
_____ _____ _____ ____ __ __
| __ | __| _ | \| | |
| -| __| | | |_ _|
|__|__|_____|__|__|____/ |_|
[ 2.11.1 ]

21:14:19,502 INFO [SFSWorker:Sys:1] v2.SmartFoxServer - SmartFoxServer 2X (2.11.1) READY!
21:14:22,090 INFO [main] v3.SessionFilter - BlueBox-2X Service (3.0.2) READY.
User avatar
Lapo
Site Admin
Posts: 20217
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Hi, i have a game and i get a error when i change the databaseManager to "true". can someone help me to fix that?

Postby Lapo » 17 Sep 2016, 07:20

You didn't change it as I suggested, though.
I told you to use SELECT NOW(), you used SELECT COUNT() which is not a valid statement, since COUNT requires an argument.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
sindyciaray
Posts: 1
Joined: 19 Jan 2018, 08:11
Contact:

Re: Hi, i have a game and i get a error when i change the databaseManager to "true". can someone help me to fix that?

Postby sindyciaray » 19 Jan 2018, 10:30

The DBManager Test SQL failed: SELECT COUNT()
User avatar
Lapo
Site Admin
Posts: 20217
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Hi, i have a game and i get a error when i change the databaseManager to "true". can someone help me to fix that?

Postby Lapo » 19 Jan 2018, 15:17

Hi,
SELECT COUNT() isn't valid SQL code. You need to pass the name of the column and table name.
See here:
https://www.w3schools.com/sql/sql_count_avg_sum.asp

Something like:

Code: Select all

SELECT COUNT(col_name) FROM my_table

would work.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 4 guests