Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have an init script for my MySQL database but for test purposes I wan't to use a H2 database. Anyone knows how to convert the file or at least has a list of the syntax differences ? thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
610 views
Welcome To Ask or Share your Answers For Others

1 Answer

Here is a good instruction by Matthew Casperson

Exporting from MySQL to H2

Here is a short list of steps, to convert from mysql to h2:

Fix up single quotes

CREATE TABLE `user` ( `name` varchar(20) NOT NULL,
convert to
CREATE TABLE user ( name varchar(20) NOT NULL,

Fix up hex numbers
Fix up bits
Don't include ranges in keys
Remove character sets (remove CHARACTER SET ...)
Remove COLLATE settings (f.e. COLLATE utf8_unicode_ci)
Remove indexes on BLOBS, CLOBS and TEXT fields
Make all index names unique
Use the MySQL compatibility mode (jdbc:h2:~/test;MODE=MySQL)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...