R.O.K.
R.O.K.

Reputation: 71

How to copy a database's table to another database's corresponding one using TSQLConnection/dbExpress?

I'm using C++ Builder (or Delphi 2007 and XE2) using DBExpress. I connected two databases one for firebird(my local hard disk) one for MySQL(on Web) using TSQLConnection. Then, my question is ... how can i use(make) SQL statement(or anything) to copy one table in Firebird into another table in MySQL? any comment will be very appreciate.. thanks a lot in advance..

Upvotes: 5

Views: 2646

Answers (1)

RRUZ
RRUZ

Reputation: 136431

You can't copy the content from Firebird table to an MySQL Table using a SQL statement. Another RDBMS has this functionality for example Sql Server has Linked Servers and MySQL has FEDERATED engine (only works for MySQL Databases).

So I eee two options to handle this task:

  1. Iterate over the Datasets using a SqlExpr.TSQLQuery or a SqlExpr.TSQLDataSet and then Insert each record (row) manually in the MySQL Table.

  2. Use a TClientDataSet to dump the Firebird table data using the SaveToFile method and then with another TClientDataSet load the Data using the LoadFromFile method, finally you can merge the Data of the second TClientDataSet to the MySQL Table.

Upvotes: 6

Related Questions