I need to move data from a Sybase database to a MySQL database. I use BCP to copy the sybasetables out and mysqlimport to import them into MySQL.
The problems that I haven't solved yet:
- The null values in Sybase are represented as 0-length strings in the BCP files. When loading this into MySQL, it is converted to 0 for int columns and empty Strings for char columns etc. Null values have to be represented as \n in the bcp-file in order to be inserted as NULL in MySQL (regardless of the DEFAULT value in the table).
- Date values has to be represented as e.g. 1999-01-01 in the BCP file, not as 1999-Jan-01
Is this possible to fix with bcp? Or does anyone have other useful hints, e.g. how to fix this at the MySQL side? Are there any free tools available for migrating data between different RDBMS's?
Never mind, I managed to transfer the data by writing a simple java program that moves the data from all tables. It was really simple when using jdbc's getObject/setObject (didn't need to know underlying datatypes). If I had only know how simple it was from the beginning!