Giter Club home page Giter Club logo

h2migrationtool's People

Contributors

manticore-projects avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

h2migrationtool's Issues

Missing gradle-wrapper.jar

I was trying to use online version of the tool, but it was unable to migrate any table. So I wanted to build it from source and debug. But there is no place to start since gradle-wrapper.jar is missing from gradle/wrapper directory.

This is probably because .gitignore is ignoring all *.jar, but this one jar is needed for gradlew to work.

Recovery did not work - CLI with Nullpointer

Hi Andreas,

i had no luck because of this:

java -jar H2MigrationTool.jar com.manticore.Recovery -f 1.3.176 -d zws2-lite.h2.db Juni 05, 2021 1:11:01 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: /drivers Juni 05, 2021 1:11:01 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-1.3.176.jar Juni 05, 2021 1:11:01 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-1.3.176 Juni 05, 2021 1:11:01 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-1.4.199.jar Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-1.4.199 Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-1.4.200.jar Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-1.4.200 Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-2.0.201-0616da1b8.jar Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-2.0.201-0616da1b8 Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-2.0.201-212cb2cfe.jar Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-2.0.201-212cb2cfe Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-2.0.201-281898bce.jar Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-2.0.201-281898bce Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-2.0.201-2c7cb8658.jar Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-2.0.201-2c7cb8658 Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-2.0.201-34c42e526.jar Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-2.0.201-34c42e526 Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-2.0.201-6e4746589.jar Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-2.0.201-6e4746589 Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-2.0.201-888e2284f-dirty.jar Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-2.0.201-888e2284f Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-2.0.201-8c03d6c4a.jar Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-2.0.201-8c03d6c4a Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: Found H2 library h2-2.0.201.jar Juni 05, 2021 1:11:02 NACHM. com.manticore.h2.H2MigrationTool readDriverRecords INFORMATION: H2-2.0.201 Exception in thread "main" java.lang.Exception: Failed to migrate the database. at com.manticore.h2.H2MigrationTool.main(H2MigrationTool.java:1144) Caused by: java.lang.NullPointerException at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1770) at java.base/java.util.regex.Matcher.reset(Matcher.java:416) at java.base/java.util.regex.Matcher.<init>(Matcher.java:253) at java.base/java.util.regex.Pattern.matcher(Pattern.java:1133) at com.manticore.h2.H2MigrationTool.getDriverRecord(H2MigrationTool.java:592) at com.manticore.h2.H2MigrationTool.getDriverRecord(H2MigrationTool.java:626) at com.manticore.h2.H2MigrationTool.migrate(H2MigrationTool.java:835) at com.manticore.h2.H2MigrationTool.main(H2MigrationTool.java:1137)

CLI creates migrated file name with null appended

Hello,

I am using the JAR file from:
http://manticore-projects.com/download/H2MigrationTool-1.4/H2MigrationTool-1.4-all.jar

My initial H2 Database filename is items.mv.db
I am trying to migrate the Database from 1.4.196 to 2.2.229

When I migrate the H2 Database with the GUI, as the final file name I get:
items.mv.db.229.mv.db

If I use the Command Line tool with following parameters:
C:\Downloads>java -jar H2MigrationTool-1.4-all.jar --user=user --password=password --version-from=1.4.196 --version-to=2.2.229 --db-file=C:\Downloads\items.mv.db --compression=ZIP --options=QUIRKS_MODE --force

then as result I get:
items.mv.db.229null.mv.db

Seems like somewhre a null string is appended into final filename, it is not a big issue but would be nice if both GUI and CLI gives the same results. If GUI can write the parameters into console, then it would be easier to find the corresponding CLI parameters.

Here the CLI part calls migrate tool with null connection parameters:
https://github.com/manticore-projects/H2MigrationTool/blob/master/src/main/java/com/manticore/h2/H2MigrationTool.java#L553

Then this null parameter used in the connection JDBC String without checking for null, which seems like causes the "null" value in the final filename:
https://github.com/manticore-projects/H2MigrationTool/blob/master/src/main/java/com/manticore/h2/H2MigrationTool.java#L775

Missing Main Class in Manifest Files

Hello,

Thank you very much for a nice tool to migrate H2 Databases.

I have seen that the JAR files are uploaded into Maven Central:
https://mvnrepository.com/artifact/com.manticore-projects.tools/h2migrationtool/1.4

However when I try to execute the file with -jar :

C:\Downloads>java -jar h2migrationtool-1.4.jar
no main manifest attribute, in h2migrationtool-1.4.jar

Then I tried with -cp then I also get another error:

C:\Downloads>java -cp h2migrationtool-1.4.jar com.manticore.h2.H2MigrationTool
Error: Unable to initialize main class com.manticore.h2.H2MigrationTool
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException

It seems like JAR files uploaded into Maven are somehow not working. Manifest files are all empty:
Manifest-Version: 1.0

I have found another JAR in the Web Site and it works with java -jar:
http://manticore-projects.com/download/H2MigrationTool-1.4/H2MigrationTool-1.4-all.jar

and it has correct manifest:
Manifest-Version: 1.0 Main-Class: com.manticore.h2.H2MigrationTool

Actually this 1.4 version is not listed on your Web Page, I guessed the link by existing other link for 1.3.7:
https://manticore-projects.com/H2MigrationTool/index.html

Do you plan to update the Web Site and also artifacts in Maven?

Tool does not seem to work with Windows File Paths

Hey there,

just stumbeled across this tool and tried to give it a try but had some obsticales to overcome:
To be able to execute the released JAR I had to lookup required dependencys in the jars manifest first and provide those jars alongside the main jar in /lib. No big deal, just wanted to point that one out (maybe add it to the readme?).
Required libs which needs to be provided at runtime seem to be:

  • commons-cli-1.4.jar
  • commons-io-2.8.0.jar
  • commons-lang3-3.3.2.jar

As soon as those are present the Tool runs fine (UI shows up and/or you can use the cli).

But after that I noticed that no matter what i try the tool fails right after the export step when it tries to create the new h2 Database from the generated .sql script.
It looks like the jdbc paths are build wrong when running on a Windows maschine: (the problem here is the Drive letter followed by the ':'):

INFORMATION: Wrote H2-1.4.200 database to script: D:\Test\TestH2Database.sql
Exception in thread "main" java.lang.Exception: Failed to migrate the database.
        at com.manticore.h2.H2MigrationTool.main(H2MigrationTool.java:1149)
Caused by: java.lang.Exception: Failed to created new H2-2.1.210 database: D:\Test\TestH2Database
        at com.manticore.h2.H2MigrationTool.migrate(H2MigrationTool.java:922)
        at com.manticore.h2.H2MigrationTool.main(H2MigrationTool.java:1142)
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Allgemeiner Fehler: "java.nio.file.InvalidPathException: Illegal character [:] in path at index 3: //D:/Test/TestH2Database.210null"
General error: "java.nio.file.InvalidPathException: Illegal character [:] in path at index 3: //D:/Test/TestH2Database.210null" [50000-210]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:573)
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
        at org.h2.message.DbException.get(DbException.java:216)
        at org.h2.message.DbException.convert(DbException.java:414)
        at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:340)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
        at org.h2.Driver.connect(Driver.java:59)
        at com.manticore.h2.H2MigrationTool.createFromScript(H2MigrationTool.java:799)
        at com.manticore.h2.H2MigrationTool.migrate(H2MigrationTool.java:913)
        ... 1 more
Caused by: java.nio.file.InvalidPathException: Illegal character [:] in path at index 3: //D:/Test/TestH2Database.210null
        at java.base/sun.nio.fs.WindowsPathParser.nextSlash(WindowsPathParser.java:212)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:111)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
        at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
        at java.base/java.nio.file.Path.of(Path.java:147)
        at java.base/java.nio.file.Paths.get(Paths.java:69)
        at org.h2.store.fs.disk.FilePathDisk.isAbsolute(FilePathDisk.java:308)
        at org.h2.store.fs.FileUtils.isAbsolute(FileUtils.java:144)
        at org.h2.engine.ConnectionInfo.getName(ConnectionInfo.java:457)
        at org.h2.engine.Engine.openSession(Engine.java:49)
        at org.h2.engine.Engine.openSession(Engine.java:222)
        at org.h2.engine.Engine.createSession(Engine.java:201)
        at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
        ... 5 more

So I took a quick look into the code and found two relevant occurences of "driver.connect(...)" in H2MigrationTool.java that look like this:

connection = driver.connect(
          "jdbc:h2://" + databaseFileName + ";ACCESS_MODE_DATA=r" + connectionParameters,
          properties);

In order to work properly with Windows filepaths something like this should work (using such connection strings in my own tool as well):

connection = driver.connect(
          "jdbc:h2:file:" + databaseFileName + ";ACCESS_MODE_DATA=r" + connectionParameters,
          properties);

Bringing me to the next point:
I tried to change those code parts accordingly and rebuild it locally on my machine using the provided build.xml file but can't get it to build either because of some absolute paths in the whole build xmls pointing to specific local paths and missing ClassPath configurations (those libs again mentioned above).

All in all very nice idea but does not seem to work poperly (yet) on Windows maschines unless I overlooked something.

No H2 driver found for requestion version 1.4.197

Good day,

firstly, thank you for this tool you have created. I'm trying to run from command line, upgrading a 1.4.197 db to 2.1.214. I've downloaded the respective jar files and put them in a directory. I use the -l / --lib-dir flag to point to this directory when i run the command, but I get the following error:

Exception in thread "main" java.lang.Exception: Failed to migrate the database.
	at com.manticore.h2.H2MigrationTool.main(H2MigrationTool.java:1149)
Caused by: java.lang.Exception: No H2 driver found for requestion version 1.4.197
	at com.manticore.h2.H2MigrationTool.getDriverRecord(H2MigrationTool.java:620)
	at com.manticore.h2.H2MigrationTool.getDriverRecord(H2MigrationTool.java:626)
	at com.manticore.h2.H2MigrationTool.migrate(H2MigrationTool.java:834)
	at com.manticore.h2.H2MigrationTool.main(H2MigrationTool.java:1142)

I'm using the current latest release of your tool, v1.2.
Could you please let me know what the problem could be? How can I let the tool see the jars?

Migration from 1.3.175 to 2.0.201 did not work

Hi,

trying to migrate from 1.3.175 to 2.0.201 comes up with following Exception


Exception in thread "main" java.lang.Exception: Failed to migrate the database.
at com.manticore.h2.H2MigrationTool.main(H2MigrationTool.java:1090)
Caused by: java.lang.Exception: Failed to write H2-1.3.175 database to script
at com.manticore.h2.H2MigrationTool.migrate(H2MigrationTool.java:776)
at com.manticore.h2.H2MigrationTool.main(H2MigrationTool.java:1066)
Caused by: java.lang.NoSuchMethodException: org.h2.tools.Script.process(java.sql.Connection, java.lang.String, java.lang.String, java.lang.String)
at java.base/java.lang.Class.getDeclaredMethod(Class.java:2475)
at com.manticore.h2.H2MigrationTool.writeScript(H2MigrationTool.java:626)
at com.manticore.h2.H2MigrationTool.migrate(H2MigrationTool.java:765)
... 1 more

Using CLI not getting migrated

by using H2MigrationTool-1.4-all.jar try to upgrade db from 1.4.197 -t 2.2
.220 version then getting following issue

java -jar H2MigrationTool-1.4-all.jar -l /home/prayag/keycloak/both/h2/bin -l /home/prayag/keycloak/both/22/h2/bin/h2-2.2.220.jar -f 1.4.197 -t 2.2

.220 -d /home/prayag/keycloak/keycloak-17.0.0/data/h2/keycloakdb.mv.db -u sa -p password /home/prayag/keycloak/newdb.mv.db
Exception in thread "main" java.lang.Exception: Failed to migrate the database.
at com.manticore.h2.H2MigrationTool.main(H2MigrationTool.java:561)
Caused by: java.lang.Exception: No H2 driver found for requestion version 1.4.197
at com.manticore.h2.H2MigrationTool.getDriverRecord(H2MigrationTool.java:429)
at com.manticore.h2.H2MigrationTool.getDriverRecord(H2MigrationTool.java:647)
at com.manticore.h2.H2MigrationTool.migrate(H2MigrationTool.java:806)
at com.manticore.h2.H2MigrationTool.main(H2MigrationTool.java:551)

Java version (class file version 55.0)

Is there a reason why the JAR file are compiled with Java 11 (class file version 55.0)
H2 itself, can use Java 8
If there are no reason (just a mistake), then can it please be compiled with Java 8, which makes migration easier! (if there OS only have java 8 installed)

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.