Delphi - Firebird data migration - different character sets

1.1k views Asked by At

I need to migrate the data from different old databases to the new ones (created with IBExpert on Firebird 2.5). I'm using the FIBPlus components. Now I know that the old varchars and blob texts are in different character sets and collations(most of them WIN1252).

DBImport(database from which I get the data) has the following properties:

  pFIBDBBase.DBName := path_to_the_database_file;
  pFIBDBBase.ConnectParams.UserName := 'SYSDBA';
  pFIBDBBase.ConnectParams.Password := 'masterkey';
  pFIBDBBase.ConnectParams.CharSet := 'NONE';
  pFIBDBBase.SQLDialect := 3;

DBNew(the new database)has the following properties:

  pFIBDBSecond.ConnectParams.UserName := 'SYSDBA';
  pFIBDBSecond.ConnectParams.Password := 'masterkey';
  pFIBDBSecond.ConnectParams.CharSet := 'UTF8';
  pFIBDBSecond.SQLDialect := 3;

I get fields definition by using the SQL provided by TOndrej here

In the new database the same fields are now UTF8.

My question is: if I am using FieldByName('etc').AsString to read from the old database, and ParamByName('etc').AsString to fill the new database, it is 100% that the string and text blob data are the same (regardless the DBImport field's charset)?

1

There are 1 answers

0
evdkraan On BEST ANSWER

I did the same in 2011 for an Interbase 2007 database with Delphi XE and IBDac components.

We have be working with the new UTF-8 database since december 2011 and I have not seen any issues with the database migration from NONE to UTF-8.

I will not guarantee 100%, but it looks like the conversion went flawless.

Because all Datasets (FIBPlus or IBDac) or inherited from the original TDataset, the AsString should work the some for but components, so if it worked with IBDac it should work the same way for FIBPlus.

You could also use IBExpert to do an insert to the new table in the new database with a select from the old table in the old database and IBExpert will take care of the string conversion. This was not an option for me, because IBExpert would not do this for Interbase. You can find more information on this at http://ibexpert.net/ibe/index.php?n=Doc.ConvertYourFirebirdApplicationsToUnicode