Giter Club home page Giter Club logo

mysql2h2-converter's Introduction

mysql2h2-converter

A MySQL to H2 SQL conversion library written in Java.

Parse a MySQL dump and convert it to H2 statements either as an embedded library or as a standalone tool.

Next steps can include:

Other ideas:

Usage

As a library:

private static void convertAndCreate(Statement stmt, String sqlDump) throws SQLException, ParseException {
    Iterator<SqlStatement> sourceIterator = SQLParserManager.parseScript(new StringReader(sqlDump));
    Iterator<SqlStatement> converted = H2Converter.convertScript(sourceIterator);
    while (converted.hasNext()) {
        stmt.execute(converted.next().toString());
    }
}

On the command line, after mvn package of course:

$ java -jar target/mysql2h2-converter-tool-0.3.0.jar demos/disconf-mysql.sql > disconf-h2.sql

Building

mvn clean package will generate the SQL parser and build an executable JAR.

enhance branch

Extend the parser to support more statements, see BasicTest and ConverterTest diff for details.

Since last commit of andrewparmet/mysql2h2-converter is 2018, change this library's pom to a new group and new version, and you can use the new one from JitPack.

Gradle example:

Step 1. Add the JitPack repository to your build file:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency:

dependencies {
    implementation 'com.github.alphahinex:mysql2h2-converter:0.3.0'
}

License

This code is provided under the MIT license.

mysql2h2-converter's People

Contributors

alphahinex avatar bgranvea avatar knightliao avatar andrewparmet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.