Hello everyone,

What is the best way to copy data from one database to another database
using ADO?

Database backend could be Interbase, MS SQL 7.0 or Oracle.

I use the following code from book Mastering Delphi 5 P572 from Marco Cantu.

procedure TForm1.Button1Click(Sender: TObject);
var
  I: Integer;
begin
  ADOConnectionSource.Connected := True;
  ADOConnectionDestination.Connected := True;

  ADOTableSource.TableName := 'WhatEver';
  ADOTableDestination.TableName := 'WhatEver';

  ADOTableSource.Open;
  ADOTableDestination.Open;
  try
    while not ADOTableSource.Eof do
    begin
      ADOTableDestination.Insert;
      for I := 0 to ADOTableSource.Fields.Count - 1 do
      begin

ADOTableDestination.FieldByName(ADOTableSource.Fields[I].FieldName).Value :=
ADOTableSource.Fields[I].Value;
      end;
      ADOTableSource.Next;
      ADOTableDestination.Post;
    end;
  finally
    ADOTableSource.Close;
    ADOTableDestination.Close;
    ADOConnectionSource.Connected := False;
    ADOConnectionDestination.Connected := False;
  end;
  MessageDlg('finished', mtConfirmation, [mbOK], 0);
end;

But I was not happy about the code, because in Client/Server concept, I
should not use Table component. I heard that DTS from SQL 7.0 can actually
migrate data from one OLE/DB provider to another. But the license for that
without SQL 7.0 is uncertainty.

And I am not sure how to handle self reference table.

ADOExpress is an extra layer on top of ADO, which might slow the speed.
By the way, I am talking about around 1G Interbase file to convert to other
data source. So stability and speed are in consideration.

I left BDE solution is because memory hold by SQL links for copy one table
contain 1 million records which potentialy can grow to 700M virtual memory
eventually run out of memory.

Any ideas?
Thanks in advance


Best Regards
Leigh Wanstead
Software Engineer
SoftTech New Zealand


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to