Skip to content

nOutput_H2 error Unknown data type: "DATETIME" #286

Description

@abrizida

Describe the bug
When activating the H2 output, an error is seen on the logs:
org.h2.jdbc.JdbcSQLNonTransientException: Unknown data type: "DATETIME"; SQL statement:
create table if not exists ATTRIBUTES(name varchar(255) primary key, description varchar(4000), last_seen datetime) [50004-240]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
at org.h2.message.DbException.get(DbException.java:223)
at org.h2.message.DbException.get(DbException.java:199)
at org.h2.command.Parser.readIfDataType1(Parser.java:5908)
at org.h2.command.Parser.readIfDataType(Parser.java:5739)
at org.h2.command.Parser.parseColumnWithType(Parser.java:5721)
at org.h2.command.Parser.parseColumnForTable(Parser.java:5600)
at org.h2.command.Parser.parseTableColumnDefinition(Parser.java:8983)
at org.h2.command.Parser.parseCreateTable(Parser.java:8926)
at org.h2.command.Parser.parseCreate(Parser.java:6483)
at org.h2.command.Parser.parsePrepared(Parser.java:648)
at org.h2.command.Parser.parse(Parser.java:584)
at org.h2.command.Parser.parse(Parser.java:559)
at org.h2.command.Parser.prepareCommand(Parser.java:487)
at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:647)
at org.h2.engine.SessionLocal.prepareCommand(SessionLocal.java:563)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1160)
at org.h2.jdbc.JdbcStatement.executeUpdateInternal(JdbcStatement.java:190)
at org.h2.jdbc.JdbcStatement.executeUpdate(JdbcStatement.java:147)
at openaf.core.DB.u(DB.java:514)
at openaf.DB.u(DB.java:103)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:225)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:423)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:43)
at org.mozilla.javascript.gen._openaf_nAttrMon_config_objects_nOutput_H2_js_5._c_anonymous_8(/openaf/nAttrMon/config/objects/nOutput_H2.js:146)
at org.mozilla.javascript.gen._openaf_nAttrMon_config_objects_nOutput_H2_js_5.call(/openaf/nAttrMon/config/objects/nOutput_H2.js)
at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74)
at openaf_js._c_anonymous_442(openaf_js:189)
at openaf_js.call(openaf_js)
at org.mozilla.javascript.Synchronizer.call(Synchronizer.java:57)
at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:29)
at openaf_js._c_anonymous_441(openaf_js:189)
at openaf_js.call(openaf_js)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:67)
at org.mozilla.javascript.gen._openaf_nAttrMon_config_objects_nOutput_H2_js_5._c_anonymous_7(/openaf/nAttrMon/config/objects/nOutput_H2.js:145)
at org.mozilla.javascript.gen._openaf_nAttrMon_config_objects_nOutput_H2_js_5.call(/openaf/nAttrMon/config/objects/nOutput_H2.js)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:60)
at noutput_js._c_anonymous_2(noutput_js:19)
at noutput_js.call(noutput_js)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:60)
at nplug_js._c_anonymous_3(nplug_js:76)
at nplug_js.call(nplug_js)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:54)
at nmain_js._c_anonymous_83(nmain_js:1309)
at nmain_js.call(nmain_js)
at org.mozilla.javascript.ArrowFunction.call(ArrowFunction.java:47)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:67)
at openaf_js._c_anonymous_518(openaf_js:217)
at openaf_js.call(openaf_js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:383)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:4449)
at openaf_js.call(openaf_js)
at openaf.plugins.Threads$ScriptFunction.call(Threads.java:64)
at openaf.plugins.Threads$ScriptFunction.run(Threads.java:77)
at java.base/java.util.concurrent.ThreadPerTaskExecutor$TaskRunner.run(ThreadPerTaskExecutor.java:314)
at java.base/java.lang.VirtualThread.run(VirtualThread.java:329)

To Reproduce
Steps to reproduce the behavior:

  1. Copy [01.h2output.yaml] from /openaf/nAttrMon/config/outputs.disabled/yaml/ to /openaf/nAttrMon/config/outputs/ folder
  2. Stop and start nAttrMon
  3. Check nAttrMon log file (nattrmon.log)

Expected behavior
The H2 database should be running, a file under config folder created (nattrmon_db.db) and the history page should show with historical data for all the inputs.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions