Page 1 of 1

Lost Connection on Delphi XE - but only if FetchAll=False

Posted: Tue 18 Oct 2011 13:22
by RNOVAK
I am converting some code from Delphi 2006 to Delphi XE (DBExpress), I found a problem:

on example
SQLDataConnDirect is TSQLConnection
qu is a TSQLQuery
the TSQLQuery is linked only whith the TSQLConnection

//this works on D2006:
SQLDataConnDirect.LoginPrompt := false;
SQLDataConnDirect.DriverName := 'DevartMySQLDirect';
SQLDataConnDirect.LibraryName := 'dbexpmda30.dll';
SQLDataConnDirect.VendorLib := 'not used';
SQLDataConnDirect.GetDriverFunc := 'getSQLDriverMySQLDirect';
SQLDataConnDirect.Params.Clear;
SQLDataConnDirect.Params.Add('User_Name=root');
SQLDataConnDirect.Params.Add('Password=xxx');
SQLDataConnDirect.Params.Add('HostName=127.0.0.1:3308);
SQLDataConnDirect.Params.Add('DataBase=MyDataBase');
SQLDataConnDirect.Params.Add('FetchAll=False');
SQLDataConnDirect.Params.Add('EnableBoolean=False');
SQLDataConnDirect.Params.Add('Custom String=Compress=True;Protocol=TCP');

SQLDataConnDirect.Open...

//==>MyTable with more than 177 MB
qu.SQL.Text := 'Select * from MyTable;';
qu.Open;
qu.Close; //OK

//-------------------------------------------------------------------------
//this fails on XE:
SQLDataConnDirect.LoginPrompt := false;
SQLDataConnDirect.DriverName := 'DevartMySQLDirect';
SQLDataConnDirect.LibraryName := 'dbexpmda40.dll';
SQLDataConnDirect.VendorLib := 'not used';
SQLDataConnDirect.GetDriverFunc := 'getSQLDriverMySQLDirect';
SQLDataConnDirect.Params.Clear;
SQLDataConnDirect.Params.Add('User_Name=root');
SQLDataConnDirect.Params.Add('Password=xxx');
SQLDataConnDirect.Params.Add('HostName=127.0.0.1:3308);
SQLDataConnDirect.Params.Add('DataBase=MyDataBase');
SQLDataConnDirect.Params.Add('FetchAll=False');
SQLDataConnDirect.Params.Add('EnableBoolean=False');
SQLDataConnDirect.Params.Add('Custom String=Compress=True;Protocol=TCP');

SQLDataConnDirect.Open...

//==>MyTable with more than 177 MB
qu.SQL.Text := 'Select * from MyTable;';
qu.Open;
qu.Close; // <<== Lost Connection <<== problem
//-------------------------------------------------------

If MyTable is little data ( 2 MB), works fine, the error happens if MyTable is wih more data, on example 177MB.

Well, but if
SQLDataConnDirect.Params.Add('FetchAll=True');
so works fine...
seams the problem resides when FetchAll=False...

Maybe bug?

I am using DBExpress MySQL Devart 5.0.1.

Roberto

Posted: Thu 20 Oct 2011 14:53
by Dimon
Try to change LibraryName to dbexpmda40.dll.

Code: Select all

SQLDataConnDirect.LibraryName := 'dbexpmda40.dll'; 

Posted: Thu 20 Oct 2011 16:13
by RNOVAK
Already using 'dbexpmda40.dll' on example (see code on Delphi XE).
The code on Delphi 2006 is working OK.

"
...
//-------------------------------------------------------------------------
//this fails on XE:
SQLDataConnDirect.LoginPrompt := false;
SQLDataConnDirect.DriverName := 'DevartMySQLDirect';
SQLDataConnDirect.LibraryName := 'dbexpmda40.dll'; <<==
SQLDataConnDirect.VendorLib := 'not used';
...

"
Roberto

Posted: Thu 20 Oct 2011 19:15
by RNOVAK
New Tests

- Tested on Delphi 2010 and Delphi XE (DBX4)
- Tests on MySQL Community versions:
5.1.42
5.1.57
5.5.16

Error is the same. "Lost Connection to MySQL Server during query"
Only if "FetchAll=False".
If FetchAll=True, works fine.

- Tested on Delphi 2006 (DBX3)
Works fine for all SGDBs above.

Roberto

Posted: Mon 24 Oct 2011 10:58
by AndreyZ
Thank you for the information. We have reproduced the problem and investigation of the problem is in progress. As soon as we have any results we will let you know.

Posted: Tue 25 Oct 2011 12:51
by AndreyZ
We have investigated this problem. In this case the 'Lost connection to MySQL server during query' error is an internal dbExpress driver for MySQL error that is used for internal purposes. Such dbExpress driver for MySQL behaviour is correct, it is caused by specificity of working with not fetched data. You will see the 'Lost connection to MySQL server during query' error only if you run your application from IDE. You will not see this error when you run the executable file of your application.

Posted: Wed 26 Oct 2011 01:28
by RNOVAK
Very thanks, it is a really trap !
I did new tests from executable generated from Delphi XE x MySQL 5.1, and worked well.
The exception occurs only inside IDE.
I putted too 'ignore to that exception' when debuging inside IDE and the code succeeded. The result was exactly the expected.

Roberto

Posted: Wed 26 Oct 2011 07:53
by AndreyZ
If you have any other questions, please contact us.