#1 2015-08-06 12:08:28

sergioschel
Member
From: Brazil
Registered: 2014-10-23
Posts: 9

Problem with timeout MySQL + ZEOS

Hello,
I am using the example 13 - StandAlone JSON SQL server, I changed the connection to use MySQL with ZEOS:

Props := TSQLDBZEOSConnectionProperties.Create('zdbc:mysql://localhost:3306/teste?username=root;password=root;MYSQL_OPT_RECONNECT=TRUE','teste', '', '');

The Process function of the standard return is UTF8 but after connection timeout of MySQL the process function returns AnsiString.

To test I put the MySQL server timeout 10 seconds.

Run SQL command that return with special character as select campo from teste

Return before timeout: [{"campo":"Está correto"}]

Return after timeout: [{"campo":"Está correto"}]

Please help smile

Last edited by sergioschel (2015-08-06 12:11:01)

Offline

#2 2015-08-06 13:32:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: Problem with timeout MySQL + ZEOS

What do you mean by "I put the MySQL server timeout" ?

I guess there should be an option to force an UTF-8 automatic reconnection via MYSQL_OPT_RECONNECT.

Offline

#3 2015-08-06 13:57:34

sergioschel
Member
From: Brazil
Registered: 2014-10-23
Posts: 9

Re: Problem with timeout MySQL + ZEOS

Hi ab,

Thanks for return,

how can i do it  in reconnecting?

Offline

#4 2015-08-06 14:29:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: Problem with timeout MySQL + ZEOS

I do not know.

You have to check the MySQL provider options, or perhaps ask in ZDBC forum.

Offline

#5 2016-02-28 21:09:09

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: Problem with timeout MySQL + ZEOS

Avoiding loosing the connection is probably the next best thing after automatic reconnect.
Calling TZConnection.Ping  with a smaller than timeout frequency should be enough to practically keep the connection open.

http://dev.mysql.com/doc/refman/5.7/en/mysql-ping.html

I am not sure whether it should be MYSQL_OPT_RECONNECT=TRUE or MYSQL_OPT_RECONNECT=1.

Offline

Board footer

Powered by FluxBB