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.
SQL SupportCompatibility modes for IBM DB2, Apache Derby, HSQLDB, MS SQL Server, MySQL, Oracle, and PostgreSQL.
MySQL is a server - based database - it runs as a separate process from your application, and is commonly used in production deployments. H2 is a lightweight database, which can run entirely in-memory, or with disk storage, either in your application's process (embedded) or in a separate process.
H2 Database and Microsoft SQL Server belong to "Databases" category of the tech stack. According to the StackShare community, Microsoft SQL Server has a broader approval, being mentioned in 697 company stacks & 2723 developers stacks; compared to H2 Database, which is listed in 9 company stacks and 19 developer stacks.
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)
There are a number of database tools that help migrating data from one to another database, for example:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With