Error on MS SQL but not on MySQL

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Error on MS SQL but not on MySQL

Post by oz8hp » Wed 05 May 2010 09:04

I have an application that normaly runs on MySQL but now I want to switch to MS SQL but I get a strange error in an update procedure that runs very fine on MySQL.

[DBNETLIB][ConnectionOpen (PreLoginHandshake()).]General network error. Check your network documentation.

The unit with the failing update is as follows:

unit U_CreateCenterPayments;

interface

procedure Center_Payments_Create;

implementation

uses
Dialogs, Forms, SysUtils, Windows,
DB, UniDacVcl, Uni,
U_UniDAC,
U_Dates,
U_Logfile,
F_Main,
F_DBConn,
U_Database,
U_Settings,
U_SystemSettings,
U_ThisApplication,
U_Globals;


procedure Center_Payments_Create;
var
QueryInput: TUniQuery;
SourceInput: TUniDataSource;
QueryOutput: TUniQuery;
begin
UniDAC.TableEmpty(TableCenterPayments);
bolRunning := True;
Panel_Update(0, 'Gør klar til opdatering af data. Vent venligst.....');
Logfile.Event(conAction_Transfer, 'Behandlinger pr. kabine pr. center', conUpdate_Start);
QueryOutput := TUniQuery.Create(Nil);
SourceInput := TUniDataSource.Create(Nil);
QueryInput := TUniQuery.Create(Nil);
QueryInput.Connection := frmDBConn.conDBserver;
QueryInput.SQL.Add('SELECT * FROM ' + TableEvents);
QueryInput.SQL.Add('WHERE EventType = 3');
QueryInput.UniDirectional := True;
QueryInput.Debug := Settings.Debug_Input;
QueryInput.UniDirectional := True;
QueryInput.Execute;
SourceInput.DataSet := QueryInput;
Panel_Update(0, 'Finder behandlinger pr. kabine pr. center. Vent venligst.....');
try
QueryOutput.Connection := frmDBConn.conDBserver;
QueryOutput.SQL.Clear;
QueryOutput.SQL.Add('INSERT INTO ' + TableCenterPayments);
QueryOutput.SQL.Add('(fldCenterID, fldEvent, fldCabin, fldBehand ');
QueryOutput.SQL.Add(',fldDate, fldTime, fldHour, fldDay ');
QueryOutput.SQL.Add(',fldDayname ,fldWeek');
QueryOutput.SQL.Add(') Values (');
QueryOutput.SQL.Add(':CenterID, :EventType, :KabineNo, :Behand ');
QueryOutput.SQL.Add(',:fldDate, :fldTime, :fldHour, :fldDay ');
QueryOutput.SQL.Add(',:fldDayname, :fldWeek');
QueryOutput.SQL.Add(')');
try
while not SourceInput.DataSet.Eof do
try
begin
QueryOutput.ParamByName('CenterID').Assign(SourceInput.DataSet.FieldByName('CenterID'));
QueryOutput.ParamByName('EventType').Assign(SourceInput.DataSet.FieldByName('EventType'));
QueryOutput.ParamByName('KabineNo').Assign(SourceInput.DataSet.FieldByName('KabineNo'));
QueryOutput.ParamByName('Behand').Assign(SourceInput.DataSet.FieldByName('Behand'));
QueryOutput.ParamByName('fldDate').Assign(SourceInput.DataSet.FieldByName('fldDate'));
QueryOutput.ParamByName('fldTime').Assign(SourceInput.DataSet.FieldByName('fldTime'));
QueryOutput.ParamByName('fldHour').Assign(SourceInput.DataSet.FieldByName('fldHour'));
QueryOutput.ParamByName('fldDay').Assign(SourceInput.DataSet.FieldByName('fldDay'));
QueryOutput.ParamByName('fldDayname').Value := LongDayNames[Integer(SourceInput.DataSet.FieldByName('fldDay').Value)];
QueryOutput.ParamByName('fldWeek').Assign(SourceInput.DataSet.FieldByName('fldWeek'));
QueryOutput.Debug := Settings.Debug_Output;
QueryOutput.Execute;
Application.ProcessMessages;
SourceInput.DataSet.Next;
end; //Not SourceInput.DataSet.Eof
except
on E:Exception do
begin
Logfile.Error(E.Message);
Application.ProcessMessages;
SourceInput.DataSet.Next;
end
end;
finally
QueryInput.Free;
QueryOutput.Free;
Application.ProcessMessages;
System_Update_Time;
end;
except
on EAccessViolation do
begin
Logfile.Event(conSource_System, conAction_Transfer, 'AccessViolation - tranfering data!');
end;
end; //try
Logfile.Event(conAction_Transfer, 'Behandlinger pr. kabine pr. center', conUpdate_Stop);
Panel_Reset;
bolRunning := False;
end;


end.

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

Post by Dimon » Wed 05 May 2010 09:34

I can not reproduce the problem.
Try to compose a small sample to demonstrate the problem and send it to dmitryg*devart*com.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Post by oz8hp » Wed 05 May 2010 10:53

That would be a difficult task to create a sample of this :D

I have tried to set conDBserver.SpecificOptions.Values['ConnectionTimeout'] := '100';
in my TDataModule and that looks like it helps - I will test some more to see if any other problems appears as I get more data converted (have >9.000.000.000 records in one table!)

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

Post by Dimon » Wed 05 May 2010 14:27

Feel free to contact us if you have any further questions about UniDAC.

Post Reply