Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

CUBRID Migration Toolkit FAQ


4. FAQ

Q: If there is an expression in ‘Default’ clause of a table column in the source database, what can I do? For example: There is a table defined as "create table a1 (f1 varchar(120) default to_char(sysdate,’yyyy’))" in an Oracle DB.

A: Before CUBRID 9.0.0.x, a table column’s ‘Default’ value must be a constant value, so users should change this expression to a constant value in column mapping UI.

 

Q: If i want to export many SQL tables into one file, what should i do?

A: There are two ways: One is unchecking the option "One table one file" which is in the second step of migration wizard; Another way is changing the SQL tables' target name to same, for example:

4-2-1.png

 

 

Q: How to create a migration script and run it in the migration console tool?

A: First of all, at the confirm page, you can find a button "Export Script" as follows, 

4-3-1.png

     Clicking it will pop a saving dialog and you should specify a XML file which the migration configurations will be saved into.

     Then you should copy the XML migration script file to the remote server where you want to run it.

     Make sure that the migration console tool has been installed in the remote server.

     Call the migration.bar(windows) or migration.sh(linux) and send the full name of the migration scirpt file as its latest parameter. For example:

     "migration.sh /home/cmt/console/migration_script.xml"

     You can add "-sd" parameter to specify the source database's JDBC driver file, For example:

    "migration.sh -sd /home/cubrid/jdbc.jar /home/cmt/console/migration_script.xml"

    You can add "-td" parameter to specify the target database's JDBC driver file, For example:

    "migration.sh -td /home/cubrid/jdbc.jar /home/cmt/console/migration_script.xml"

    You can add "-tp" parameter to specify where the output files will be saved if you have set the target is CUBRID dump/CSV/SQL/XLS files, For example:

    "migration.sh -tp /home/cubrid/output /home/cmt/console/migration_script.xml"

 

Q: How to use user defined column data handler?

A: At the column mapping view:

This setting includes two parts: the jar file name and the full class name of the handler in the jar file.

 

The jar file should be in the "handlers" directory of the migration application’s working directory, for example:

The handler class must implement a method "public Object convert(Map<String,Object> recordMap,String columnName)", for example:

 

package  com.cubrid.migration;

public  class  TestConvert {
    public  Object convert(Map<String,Object> recordMap,String columnName) {
        return  "Test for data handler:" + recordMap.get(columnName);
    }
}

 

Parameter "recordMap" stores the record’s column and data information: the key of the map is source table’s column name and the value of the map is the column’s data.

Parameter "columnName" is the current source table’s column name to be handled.

Return value should be the data which will be inserted into target.

During the migration, the method "convert" will be called to convert the data from source to the data which will be written into target.

And all dependences of the handler class should be packaged into the jar file to ensure the handler can work well.

Note: if the "recordMap.get(columnName)" returns null, null value will be returned directly by CMT ant it will not pass the handler.

 

comments powered by Disqus
Page info
viewed 1020 times
translations en
Author
posted last year by
kevinlin79
Contributors
updated last year by
View revisions
tagged
Share this article