TIBCLoader: SQL error on LoadFromDataset
Posted: Tue 18 Nov 2014 14:57
Hey there.
I have problems using the TIBCLoader to copy tables from database A to database B. The table is identically defined in both databases. This is the rough sketch of things:
in pseudo-code:
1) Get connections to database A and B
2) use a query to retrieve the data to be moved from database A
3) setup an IBCLoader to have destination B, then use LoadFromDataset to move the data
Executing this, I get the following error:
Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 663
OR
I am running version 5.2.6 on Delphi XE
I have problems using the TIBCLoader to copy tables from database A to database B. The table is identically defined in both databases. This is the rough sketch of things:
Code: Select all
procedure TForm4.Button10Click(Sender: TObject);
var
sourceconn, destConn : TIBCConnection;
QSource : TIBCQuery;
IBCLoader : TIBCLoader;
tablename : STring;
i : integer;
begin
sourceConn := TIBCConnection.Create(nil);
destConn := TIBCConnection.Create(nil);
sourceConn.ClientLibrary := 'gds32.dll';
sourceConn.Database := someDatabasePath;
sourceConn.Password := 'masterkey';
sourceConn.SQLDialect := 3;
sourceConn.Username := 'sysdba';
sourceConn.Connected := True;
sourceConn.Options.UseUnicode := True;
destConn.ClientLibrary := 'gds32.dll';
destConn.Database := someOtherDatabasePath;
destConn.Password := 'masterkey';
destConn.SQLDialect := 3;
destConn.Username := 'sysdba';
destConn.Connected := True;
destConn.Options.UseUnicode := True;
QSource := TIBCQuery.Create(nil);
QSource.Connection := sourceconn;
tablename := 'PROJECT';
QSource.sql.Add('SELECT * FROM ' + tablename);
QSource.Open;
IBCLoader := TIBCLoader.Create(nil);
IBCLoader.TableName := tablename;
IBCLoader.InsertMode := imUpdateOrInsert;
IBCLoader.Connection := destConn;
IBCLoader.AutoCommit := False;
IBCLoader.Options.QuoteNames := True;
try
if QSource.RecordCount > 0 then begin
IBCLoader.RowsPerBatch := 10;
IBCLoader.LoadFromDataSet(QSource);
end;
except
on E: Exception do begin
Application.ProcessMessages;
messageDlg('Error: ' + E.Message,mtError,[mbOk], 0);
end;
end;
end;
1) Get connections to database A and B
2) use a query to retrieve the data to be moved from database A
3) setup an IBCLoader to have destination B, then use LoadFromDataset to move the data
Executing this, I get the following error:
Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 663
OR
I am running version 5.2.6 on Delphi XE