[Problem] When I use mysql_close(), the sql can't connect.
#1

Hello.
I havr problem, I don't know why but when I use mysql_close() on OnGameModeExit, the mysql
cannot conenct in the server.
I saw in the mysql_log:
Quote:

[10:33:43] >> mysql_connect(127.0.0.1, root, ddr, ******) on port 3306
[10:33:43] CMySQLHandler::CMySQLHandler() - constructor called.
[10:33:43] CMySQLHandler::CMySQLHandler() - Connecting to "127.0.0.1" | DB: "ddr" | Username: "root"
[10:33:43] CMySQLHandler::Connect() - Connection was successful.
[10:33:43] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[10:33:43] >> mysql_ping( Connection handle: 1 )
[10:33:43] CMySQLHandler::Ping() - Connection is still alive.
[10:33:43] >> mysql_close( Connection handle: 1 )
[10:33:43] CMySQLHandler::~CMySQLHandler() - deconstructor called.
[10:33:43] CMySQLHandler::FreeResult() - The result is already empty.
[10:33:43] CMySQLHandler:isconnect() - Connection was closed.

but when I remove the mysql_close, he can connect.
Thanks.
Reply
#2

mysql_close() ends the connection to the server. You should ONLY call it under OnGameModeExit(), if you're calling it elsewhere, it's probably why you're having the connection issue.

According to the log file, you're connecting to the MySQL server, and disconnecting from the MySQL server at the exact same time (roughly).
Reply
#3

I dont have mysql_close() in OnGameModeInit.
That's what I have in OnGameModeInit:
Quote:

mysql_debug(1);
gHandle = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);

and OnGameModeExit:
Quote:

mysql_close();

Anyone know what is the problem?
Reply
#4

Then perhaps another script that you have running is closing the connection?
Reply
#5

No...
Reply
#6

Can you show me ALL of the code you have under OnGameModeInit()?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)