Mysql dump in derby

I use derby for development in eclipse. Is it possible to dump a table from MySQL and somehow use it for a derby? I know that ddl and dml are different for both dbms, but I'm looking for a way other than dump / export that would be appropriate.

+5
source share
3 answers

There are two options that I can find; if I understand your question correctly, I think that at least one of them will cover what you are looking for.

If the focus is data (or a subset of them) from the same table, use ijas indicated in the Derby Tools Documentation (see "Using Bulk Import and Export Procedures"). Data can be retrieved from MySQL using the built-in formatting commands in the required format, which seems to be pretty standard CSV (this will require a table that already exists in your Derby database).

Here is an example from the MySQL forums:

SELECT a,b,a+b INTO OUTFILE '/tmp/result.text'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM test_table; 

If you want to import everything, Apache DdlUtils will allow you to migrate the entire schema from MySQL to Derby. This will not require redefining the table in Derby, as it will be considered as part of the import / export process using DdlUtils.

+3

, DBCopy Plugin SQuirreL SQL Client. , , , , ( ).

, DDL, , , CSV.

+1

MySQL ( ) Derby ( ), :

mysqldump -u root -h 127.0.0.1 --compatible=ansi --complete-insert --skip-add-drop-table --skip-add-locks --skip-comments --skip-disable-keys --skip-set-charset --no-create-info dbname > export.sql

Derby . !

0

All Articles