Hi,
I want to extract H2 database from a mangoES version 2.5.2 and restore it into a mangoES version 2.7.10. I tired that, but it didn’t work and the following is the log file output, I just want to know is it possible to do that with different version and how should I do that. I should say that I cannot upgrade the version 2.5.2 to 2.7.10 as it’s a running project and it’s in remote area, I want to restore the database one a mango with version 2.7.10 and send that to site to substitute. Appreciate your help in this regard.
ERROR 2016-05-31 14:15:14,494 (com.serotonin.m2m2.Main.main:120) - Error during initialization
com.serotonin.ShouldNeverHappenException: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [CREATE TABLE templates ( id int NOT NULL auto_increment, xid varchar(50) NOT NULL, name VARCHAR(255), template
Type VARCHAR(50), readPermission VARCHAR(255), setPermission VARCHAR(255), data longblob NOT NULL, PRIMARY KEY (id) ); ]; nested exception is org.h2.jdbc.JdbcSQLException: Table "TEMPLATES" already exists; SQL statement:
CREATE TABLE templates ( id int NOT NULL auto_increment, xid varchar(50) NOT NULL, name VARCHAR(255), templateType VARCHAR(50), readPermission VARCHAR(255), setPermission VARCHAR(255), data longblob NOT NULL, PRIMARY KEY (id) ); [42101-
181]
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:102)
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:34)
at com.serotonin.m2m2.db.DatabaseProxy.initialize(DatabaseProxy.java:180)
at com.serotonin.m2m2.Lifecycle.databaseInitialize(Lifecycle.java:602)
at com.serotonin.m2m2.Lifecycle.initialize(Lifecycle.java:280)
at com.serotonin.m2m2.Main.main(Main.java:116)
Caused by: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [CREATE TABLE templates ( id int NOT NULL auto_increment, xid varchar(50) NOT NULL, name VARCHAR(255), templateType VARCHAR(50), readPermissio
n VARCHAR(255), setPermission VARCHAR(255), data longblob NOT NULL, PRIMARY KEY (id) ); ]; nested exception is org.h2.jdbc.JdbcSQLException: Table "TEMPLATES" already exists; SQL statement:
CREATE TABLE templates ( id int NOT NULL auto_increment, xid varchar(50) NOT NULL, name VARCHAR(255), templateType VARCHAR(50), readPermission VARCHAR(255), setPermission VARCHAR(255), data longblob NOT NULL, PRIMARY KEY (id) ); [42101-
181]
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:415)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:439)
at com.serotonin.m2m2.db.H2Proxy.runScript(H2Proxy.java:146)
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:129)
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:143)
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:134)
at com.serotonin.m2m2.db.upgrade.Upgrade10.upgrade(Upgrade10.java:30)
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:98)
... 5 more
Caused by: org.h2.jdbc.JdbcSQLException: Table "TEMPLATES" already exists; SQL statement:
CREATE TABLE templates ( id int NOT NULL auto_increment, xid varchar(50) NOT NULL, name VARCHAR(255), templateType VARCHAR(50), readPermission VARCHAR(255), setPermission VARCHAR(255), data longblob NOT NULL, PRIMARY KEY (id) ); [42101-
181]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.command.ddl.CreateTable.update(CreateTable.java:111)
at org.h2.command.CommandContainer.update(CommandContainer.java:78)
at org.h2.command.Command.executeUpdate(Command.java:254)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:185)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:159)
at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:431)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:404)
... 12 more
INFO 2016-05-31 14:15:14,500 (com.serotonin.m2m2.Lifecycle.terminate:344) - Mango Lifecycle terminating...