• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[SQL Connection with Latest TFS lost]

Status
Not open for further replies.

Zonet

Web Developer
Joined
Sep 1, 2008
Messages
4,393
Reaction score
52
Location
Tibia VS RL-life, guess whos back?
Hello everyone i got a War script bought from nahruto [<3]
And with the latest TFS in config there's something

mysqlReadTimeout = 10 <-- this one.

My friend got this script too, he is using gui and getting this problem

in the console] Access denied for user 'ODBC'@'localhost' (using password: YES)

and i'm getting this error [using my kill.lua with svargrond arena.]

I'm getting error in line 12 <-->
PHP:
if enemyGuild == getGuildWarInfo(myGuild).With then


and this getGuildWarInfo(myGuild).With <---use sql

so, i think it is TFS problem, i'll now post my latest config and the old config. my screen first.

68zuqf.jpg

Latest.

sqlType = "mysql"
sqlHost = "localhost"
sqlPort = 3306
sqlUser = "root"
sqlPass = "pass"
sqlDatabase = "dbname"
sqlFile = "forgottenserver.s3db"
sqlKeepAlive = 60
mysqlReadTimeout = 10
optimizeDatabaseAtStartup = "yes"
passwordType = "plain"


Old

sqlType = "mysql"
sqlHost = "localhost"
sqlPort = 3306
sqlUser = "root"
sqlPass = "pass"
sqlDatabase = "dbname"
sqlFile = "forgottenserver.s3db"
sqlKeepAlive = 60
optimizeDatabaseAtStartup = "yes"
passwordType = "plain"


i hope any of TFS developers take a look, what is wrong it that since when it lost the connection my server crashes.


Thank you.
 
Last edited:
For how long?

worked for 5 hours, just had to restart because of it.. But I'm not sure, since I reloaded the config while the server was running, maybe thats why it didnt work.. I know somethings in config requires the server to restart instead of just reloading
 
while still searching for the answer why TFS is loosing connection i have found that since version 5.1 of MYSQl auto reconnection to server is disabled by default (click) so i thought that this might be a good clue. I searched in code of TFS for the part that responds for reconnecting to server and i have found it in file databasemysql.cpp. Since the full version of TFS 0.3.1 this part of code looks like this

Code:
my_bool reconnect = true;
	mysql_options(&m_handle, MYSQL_OPT_RECONNECT, &reconnect);
	if(!mysql_real_connect(&m_handle, g_config.getString(ConfigManager::SQL_HOST).c_str(), g_config.getString(ConfigManager::SQL_USER).c_str(), g_config.getString(ConfigManager::SQL_PASS).c_str(), g_config.getString(ConfigManager::SQL_DB).c_str(), g_config.getNumber(ConfigManager::SQL_PORT), NULL, 0))

and since this version a have a problem with disconnecting. So i looked back to the earlier versions and i found out that till version 0.3b3 this part of code looked like this

Code:
	mysql_options(&m_handle, MYSQL_OPT_RECONNECT, &myTrue);
	if(!mysql_real_connect(&m_handle, g_config.getString(ConfigManager::SQL_HOST).c_str(), g_config.getString(ConfigManager::SQL_USER).c_str(), g_config.getString(ConfigManager::SQL_PASS).c_str(), g_config.getString(ConfigManager::SQL_DB).c_str(), g_config.getNumber(ConfigManager::SQL_PORT), NULL, 0))

as you can see in the never version the is this part of code
Code:
my_bool reconnect = true;
which i think could be wrong, everywhere in internet where i looked it is written that there should be 1 instead of true (of course I know nothing about programming in cpp so this is only a guess) but it's worth to try to change this line to
Code:
my_bool reconnect = 1;
or to drop it. Write if it s working for you, then i will try it ;)
 
while still searching for the answer why TFS is loosing connection i have found that since version 5.1 of MYSQl auto reconnection to server is disabled by default (click) so i thought that this might be a good clue. I searched in code of TFS for the part that responds for reconnecting to server and i have found it in file databasemysql.cpp. Since the full version of TFS 0.3.1 this part of code looks like this

Code:
my_bool reconnect = true;
	mysql_options(&m_handle, MYSQL_OPT_RECONNECT, &reconnect);
	if(!mysql_real_connect(&m_handle, g_config.getString(ConfigManager::SQL_HOST).c_str(), g_config.getString(ConfigManager::SQL_USER).c_str(), g_config.getString(ConfigManager::SQL_PASS).c_str(), g_config.getString(ConfigManager::SQL_DB).c_str(), g_config.getNumber(ConfigManager::SQL_PORT), NULL, 0))

and since this version a have a problem with disconnecting. So i looked back to the earlier versions and i found out that till version 0.3b3 this part of code looked like this

Code:
	mysql_options(&m_handle, MYSQL_OPT_RECONNECT, &myTrue);
	if(!mysql_real_connect(&m_handle, g_config.getString(ConfigManager::SQL_HOST).c_str(), g_config.getString(ConfigManager::SQL_USER).c_str(), g_config.getString(ConfigManager::SQL_PASS).c_str(), g_config.getString(ConfigManager::SQL_DB).c_str(), g_config.getNumber(ConfigManager::SQL_PORT), NULL, 0))

as you can see in the never version the is this part of code
Code:
my_bool reconnect = true;
which i think could be wrong, everywhere in internet where i looked it is written that there should be 1 instead of true (of course I know nothing about programming in cpp so this is only a guess) but it's worth to try to change this line to
Code:
my_bool reconnect = 1;
or to drop it. Write if it s working for you, then i will try it ;)

This is a boolean value. 1 is the same as true, 0 is the same as false.
 
@Up
I know that 1 is the same as true, and 0 is the same as false, but in c++ i think you need to put 1 or 0, not true or false because it's in Lua (i think). and as I said:
(of course I know nothing about programming in cpp so this is only a guess) but it's worth to try to change this line to
and as I said in older version of mysql this line was missing so i think that you should try change it to 1 (true) or just delete this line (i don't know xd). I think that when in this command was "true" then it's automaticaly set as 0, because in C++ it didn't know what was "true" so it automaticaly set it to 0 (false).


#BTW
Testing for about 20 hours now and it's still working :O :D
 
@Up
I know that 1 is the same as true, and 0 is the same as false, but in c++ i think you need to put 1 or 0, not true or false because it's in Lua (i think). and as I said:

and as I said in older version of mysql this line was missing so i think that you should try change it to 1 (true) or just delete this line (i don't know xd). I think that when in this command was "true" then it's automaticaly set as 0, because in C++ it didn't know what was "true" so it automaticaly set it to 0 (false).


#BTW
Testing for about 20 hours now and it's still working :O :D

Boolean datatype - Wikipedia, the free encyclopedia
 
Im in Markeys Team and its the same error, but now after 20 Minutes and 30 Player ;)

04/03/2009 19:14:37 mysql_store_result(): SELECT `password` FROM `accounts` WHERE `id` = 2887208; - MYSQL ERROR: Lost connection to MySQL server during query
 
Might this be helpful?

0.3.1 Patch, level 1:
Fixed issue(s): houseDataStorage (binary serialization), increased mysqlReadTimeout default value,changed house_storage.data fieldtype from BLOB to LONGBLOB, added-back deathLosePercent for compatibility reasons, monsters from type 'Machines' are now race 'energy', bad talkactions scripts.

Files changed: config.lua, forgottenserver.s3db, schema.mysql, schema.sqlite, The Forgotten Server.exe, data/creaturescripts/login.lua, data/globalevents/scripts/clean.lua, data/globalevents/scripts/save.lua, data/lib/function.lua, data/monster/Machines, data/talkactions/scripts/animatedtext.lua, data/talkactions/scripts/clean.lua, data/talkactions/scripts/save.lua, data/talkactions/scripts/serverinfo.lua, data/talkactions/scripts/shutdown.lua, data/talkactions/scripts/summon.lua.

0.3.1 Patch, level 2:
Fixed issue(s): reworked how violation window works, added version checking, added onJoinChannel and onLeaveChannel creature events, moved guildMotd sending to Lua creaturescript, online command, broadcastclass command, closeopen command, proper nickname displaying for private chat windows, Lua doPlayetSet*Rate function declarations, updated doc/ properly, removed caching for VIP checks when saving player.

Files changed: forgottenserver.s3db, schema.mysql, schema.sqlite, TheForgottenServer.exe, data/creaturescripts/creaturescripts.xml, data/creaturescripts/scripts/guildmotd.lua, data/creaturescripts/scripts/login.lua, data/items/items.xml, data/lib/compat.lua, data/lib/constant.lua, data/lib/function.lua, data/monster/Sorcerers/infernalist.xml, data/movements/movements.xml, data/talkactions/scripts/broadcastclass.lua, data/talkactions/scripts/online.lua, data/talkactions/scripts/closeopen.lua, doc/CHANGELOG, doc/GROUPS, doc/LUA_FUNCTIONS
 
I've read something about it, this is what wiki says.
Values of type bool are either true or false. Implicit conversions exist between bool and other integral types, floating point types, pointer types, and pointer-to-member types. In addition, user-defined types can be converted to bool via a user-defined conversion operator. In general, a zero or null-pointer value is converted to false, any other value is converted to true.
 
@trixet, I've allready tried to change the mysqlReadTimeout, but nothing changed, same problem...

Now I'm gonna test if there is a bug in the lua function of the mysql connection...
 
Status
Not open for further replies.
Back
Top