<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Import H2 database from MangoES 2.5.2 to MangoES 2.7.10]]></title><description><![CDATA[<p dir="auto">Hi,<br />
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.</p>
<p dir="auto">ERROR 2016-05-31 14:15:14,494 (com.serotonin.m2m2.Main.main:120) - Error during initialization<br />
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<br />
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:<br />
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-<br />
181]<br />
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:102)<br />
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:34)<br />
at com.serotonin.m2m2.db.DatabaseProxy.initialize(DatabaseProxy.java:180)<br />
at com.serotonin.m2m2.Lifecycle.databaseInitialize(Lifecycle.java:602)<br />
at com.serotonin.m2m2.Lifecycle.initialize(Lifecycle.java:280)<br />
at com.serotonin.m2m2.Main.main(Main.java:116)<br />
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<br />
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:<br />
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-<br />
181]<br />
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)<br />
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)<br />
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:415)<br />
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:439)<br />
at com.serotonin.m2m2.db.H2Proxy.runScript(H2Proxy.java:146)<br />
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:129)<br />
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:143)<br />
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:134)<br />
at com.serotonin.m2m2.db.upgrade.Upgrade10.upgrade(Upgrade10.java:30)<br />
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:98)<br />
... 5 more<br />
Caused by: org.h2.jdbc.JdbcSQLException: Table "TEMPLATES" already exists; SQL statement:<br />
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-<br />
181]<br />
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)<br />
at org.h2.message.DbException.get(DbException.java:179)<br />
at org.h2.message.DbException.get(DbException.java:155)<br />
at org.h2.command.ddl.CreateTable.update(CreateTable.java:111)<br />
at org.h2.command.CommandContainer.update(CommandContainer.java:78)<br />
at org.h2.command.Command.executeUpdate(Command.java:254)<br />
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:185)<br />
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:159)<br />
at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:431)<br />
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:404)<br />
... 12 more<br />
INFO  2016-05-31 14:15:14,500 (com.serotonin.m2m2.Lifecycle.terminate:344) - Mango Lifecycle terminating...</p>
]]></description><link>https://forum.mango-os.com/topic/2277/import-h2-database-from-mangoes-2-5-2-to-mangoes-2-7-10</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 05:32:09 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/2277.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 31 May 2016 06:41:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Import H2 database from MangoES 2.5.2 to MangoES 2.7.10 on Tue, 07 Jun 2016 13:14:43 GMT]]></title><description><![CDATA[<p dir="auto">It could be a typeo in a variable name, or perhaps a point was deleted that was in the context of a meta point. Something like...</p>
<p dir="auto">p1 = random numeric, script:</p>
<pre><code>return p7.value*2
</code></pre>
]]></description><link>https://forum.mango-os.com/post/11773</link><guid isPermaLink="true">https://forum.mango-os.com/post/11773</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Tue, 07 Jun 2016 13:14:43 GMT</pubDate></item><item><title><![CDATA[Reply to Import H2 database from MangoES 2.5.2 to MangoES 2.7.10 on Tue, 07 Jun 2016 08:12:28 GMT]]></title><description><![CDATA[<p dir="auto">Thanks guys, clearing browser cache worked and all good now, but I found the follwing error in ma.log, Appreciate your help.</p>
<p dir="auto">ERROR 2016-06-07 11:10:00,014 (com.serotonin.m2m2.meta.JavaScriptPointLocatorRT.executeImpl:54) - TypeError: Cannot read property "value" from undefined in &lt;eval&gt; at line number<br />
8 in &lt;eval&gt; at line number 8<br />
javax.script.ScriptException: TypeError: Cannot read property "value" from undefined in &lt;eval&gt; at line number 8 in &lt;eval&gt; at line number 8<br />
at com.serotonin.m2m2.rt.script.ScriptExecutor.prettyScriptMessage(ScriptExecutor.java:211)<br />
at com.serotonin.m2m2.rt.script.CompiledScriptExecutor.execute(CompiledScriptExecutor.java:83)<br />
at com.serotonin.m2m2.meta.JavaScriptPointLocatorRT.executeImpl(JavaScriptPointLocatorRT.java:50)<br />
at com.serotonin.m2m2.meta.MetaPointLocatorRT.execute(MetaPointLocatorRT.java:291)<br />
at com.serotonin.m2m2.meta.MetaPointLocatorRT$ScheduledUpdateTimeout.run(MetaPointLocatorRT.java:206)<br />
at com.serotonin.timer.TimerTask.runTask(TimerTask.java:148)<br />
at com.serotonin.timer.OrderedTimerTaskWorker.run(OrderedTimerTaskWorker.java:29)<br />
at com.serotonin.timer.OrderedThreadPoolExecutor$OrderedTask.run(OrderedThreadPoolExecutor.java:278)<br />
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br />
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br />
at java.lang.Thread.run(Thread.java:745)<br />
Cheers,<br />
Mohammad</p>
]]></description><link>https://forum.mango-os.com/post/11772</link><guid isPermaLink="true">https://forum.mango-os.com/post/11772</guid><dc:creator><![CDATA[mohd]]></dc:creator><pubDate>Tue, 07 Jun 2016 08:12:28 GMT</pubDate></item><item><title><![CDATA[Reply to Import H2 database from MangoES 2.5.2 to MangoES 2.7.10 on Thu, 02 Jun 2016 14:03:07 GMT]]></title><description><![CDATA[<p dir="auto">Also, clearing your browser's cache will likely resolve it assuming you have all the correct modules installed.</p>
]]></description><link>https://forum.mango-os.com/post/11756</link><guid isPermaLink="true">https://forum.mango-os.com/post/11756</guid><dc:creator><![CDATA[JoelHaggar]]></dc:creator><pubDate>Thu, 02 Jun 2016 14:03:07 GMT</pubDate></item><item><title><![CDATA[Reply to Import H2 database from MangoES 2.5.2 to MangoES 2.7.10 on Thu, 02 Jun 2016 13:43:31 GMT]]></title><description><![CDATA[<p dir="auto">Usually in a situation like that some serialization errors which are being printed to the console, which means you probably do not have the modules installed for all the data sources you have defined. I'm not sure which version you're using that's experiencing the problem, but if it is 2.7.10 you can use the modules page to make sure you have all the modules you are supposed to.</p>
]]></description><link>https://forum.mango-os.com/post/11755</link><guid isPermaLink="true">https://forum.mango-os.com/post/11755</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Thu, 02 Jun 2016 13:43:31 GMT</pubDate></item><item><title><![CDATA[Reply to Import H2 database from MangoES 2.5.2 to MangoES 2.7.10 on Thu, 02 Jun 2016 08:39:02 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I could resolve the slowness issue by purging the events and could upgrade the MangoES to 2.7.10 successfully, but I have got another issue, I cannot see the data sources but can see the data points, do you have any idea?<br />
Cheers</p>
]]></description><link>https://forum.mango-os.com/post/11751</link><guid isPermaLink="true">https://forum.mango-os.com/post/11751</guid><dc:creator><![CDATA[mohd]]></dc:creator><pubDate>Thu, 02 Jun 2016 08:39:02 GMT</pubDate></item><item><title><![CDATA[Reply to Import H2 database from MangoES 2.5.2 to MangoES 2.7.10 on Thu, 02 Jun 2016 03:30:21 GMT]]></title><description><![CDATA[<p dir="auto">Hi guys,<br />
Thanks for your support. I went for Joel solution and could restore the database on another mangoES  2.5.2 but when I tried to open whatch list or do any thing on Web interface, it's really slow (I could see the watch list), when I tried to open datasources I recived Server error:Timeout, and I couldn't upgrade that to version 2.7.10. I tried several backups for different days but the result was the same. I also tried to boot the mango in SAFE mode but that couldn't help. Appreciate your help.<br />
Cheers</p>
]]></description><link>https://forum.mango-os.com/post/11749</link><guid isPermaLink="true">https://forum.mango-os.com/post/11749</guid><dc:creator><![CDATA[mohd]]></dc:creator><pubDate>Thu, 02 Jun 2016 03:30:21 GMT</pubDate></item><item><title><![CDATA[Reply to Import H2 database from MangoES 2.5.2 to MangoES 2.7.10 on Tue, 31 May 2016 15:39:33 GMT]]></title><description><![CDATA[<p dir="auto">Your other option would be to start this database in a Mango 2.5.2 installation and then do a full upgrade from scratch on the Modules page.  After the upgrade is done go to your system setting page and perform a H2 backup.  Now take this file to the new 2.7.10 and it will work.</p>
<p dir="auto">Proper database upgrading only works when modules are also being upgraded or installed.</p>
]]></description><link>https://forum.mango-os.com/post/11743</link><guid isPermaLink="true">https://forum.mango-os.com/post/11743</guid><dc:creator><![CDATA[JoelHaggar]]></dc:creator><pubDate>Tue, 31 May 2016 15:39:33 GMT</pubDate></item><item><title><![CDATA[Reply to Import H2 database from MangoES 2.5.2 to MangoES 2.7.10 on Tue, 31 May 2016 12:58:10 GMT]]></title><description><![CDATA[<p dir="auto">Hi Mohammad,</p>
<p dir="auto">I have seen that before, and the easiest way for me to handle it has been to ensure the commands the database upgrade attempted have all been completed, then increment the schema version number. It looks like your Mango may have suffered an interrupted boot while performing <a href="https://github.com/infiniteautomation/ma-core-public/blob/e95992454b62c67cc2480787e448b03383de2848/Core/src/com/serotonin/m2m2/db/upgrade/Upgrade10.java" rel="nofollow ugc">Upgrade10</a>.</p>
<p dir="auto">You could start the Mango/bin/h2-web-console.sh script to get access to the H2 database shell (consider adding -webAllowOthers as the script discusses), then run the SQL for the upgrade manually,</p>
<p dir="auto">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) );<br />
ALTER TABLE templates ADD CONSTRAINT templatesUn1 UNIQUE (xid);<br />
ALTER TABLE dataPoints ADD COLUMN templateId INT;<br />
ALTER TABLE dataPoints ADD CONSTRAINT dataPointsFk2 FOREIGN KEY (templateId) REFERENCES templates(id);</p>
<p dir="auto">And then increment your database schema number via: UPDATE systemSettings SET settingvalue="11" where settingname="databaseSchemaVersion"</p>
<hr />
<p dir="auto">Alternatively, since the problem you are experiencing is with the first command, you could try dropping the templates table and letting Mango perform the upgrade.</p>
<hr />
<p dir="auto">I would guess this was caused by importing the JSON configuration from the old Mango to the new. We discovered an issue that the database schema versions were being imported/exported through the emport page, so if you had started a fresh 2.7.10 Mango, then imported your configuration, you could potentially get into this situation. The other way I'm aware of is to stop Java during one of these upgrades. If you suspect this is the case, you could try to simply update your systemSettings table to the current database schema (12) but you may also wish to check the existence of the jsonData table.</p>
]]></description><link>https://forum.mango-os.com/post/11741</link><guid isPermaLink="true">https://forum.mango-os.com/post/11741</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Tue, 31 May 2016 12:58:10 GMT</pubDate></item></channel></rss>