Lost Connection on Delphi XE - but only if FetchAll=False
Lost Connection on Delphi XE - but only if FetchAll=False
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
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
Try to change LibraryName to dbexpmda40.dll.
Code: Select all
SQLDataConnDirect.LibraryName := 'dbexpmda40.dll';
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
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
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
- 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
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.