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

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for MySQL in Delphi and C++Builder
Post Reply
RNOVAK
Posts: 25
Joined: Sat 19 Feb 2011 18:30
Contact:

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

Post by RNOVAK » Tue 18 Oct 2011 13:22

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

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 20 Oct 2011 14:53

Try to change LibraryName to dbexpmda40.dll.

Code: Select all

SQLDataConnDirect.LibraryName := 'dbexpmda40.dll'; 

RNOVAK
Posts: 25
Joined: Sat 19 Feb 2011 18:30
Contact:

Post by RNOVAK » Thu 20 Oct 2011 16:13

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

RNOVAK
Posts: 25
Joined: Sat 19 Feb 2011 18:30
Contact:

Post by RNOVAK » Thu 20 Oct 2011 19:15

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

AndreyZ

Post by AndreyZ » Mon 24 Oct 2011 10:58

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.

AndreyZ

Post by AndreyZ » Tue 25 Oct 2011 12:51

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.

RNOVAK
Posts: 25
Joined: Sat 19 Feb 2011 18:30
Contact:

Post by RNOVAK » Wed 26 Oct 2011 01:28

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

AndreyZ

Post by AndreyZ » Wed 26 Oct 2011 07:53

If you have any other questions, please contact us.

Post Reply