jfinal如何支持IoTDB?

近期要使用时序数据库IoTDB,请问jfinal是否支持?如何支持?@jfinal

评论区

zzutligang

2020-10-08 21:08

以我的理解,IoTDB也提供了jdbc驱动,拿到驱动,连接上,一样能拿到数据。只是这种时序数据库,数据都很稠密,你在JFinal里能怎么使用呢。动态图表化?有一个现成的图表话软件,专门用来和时序数据库配合显示动态数据的。

JFinal

2020-10-08 22:38

没用过这个数据库,如果这个库支持 ANSI Sql 标准,可以用一下 AnsiSqlDialect,配置一下:
arp.setDialect(new AnsiSqlDialect());

如果这个数据库是一个很不一样的存在,可能你需要扩展一下 Dialect

moyush

2020-10-09 15:18

zzutligang

2020-10-11 11:37

IoTDB是一个时序数据库,说是数据库,其实基本上不算什么数据库。物联网系统接收设备传感器发过来的数据,具有大吞吐量,查询速度快的特点,提供的jdbc,也就是可以通过jdbc的方式查询数据。不知道是否符合标准的 ANSI Sql

JFinal

2020-10-11 15:14

@zzutligang 你先用上 arp.setDialect(new AnsiSqlDialect());

多数功能是支持的

moyush

2020-10-28 17:07

@JFinal
测试代码如下:
DruidPlugin dp = new DruidPlugin("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
dp.setDriverClass("org.apache.iotdb.jdbc.IoTDBDriver");
ActiveRecordPlugin arp = new ActiveRecordPlugin("iotdb", dp);
arp.getEngine().setSourceFactory(new ClassPathSourceFactory());
arp.setContainerFactory(new CaseInsensitiveContainerFactory());
arp.setDialect(new AnsiSqlDialect());
arp.addSqlTemplate("all.sql");
dp.start();
arp.start();

报错如下:
2020-10-28 16:59:06.115-[Thread: main]
[ERROR]-init datasource error, url: jdbc:iotdb://127.0.0.1:6667/
org.apache.iotdb.jdbc.IoTDBSQLException: 401: meet error while parsing SQL to physical plan: {}line 1:8 mismatched input '' expecting {FROM, ',', '.'}
at org.apache.iotdb.jdbc.IoTDBStatement.executeQuerySQL(IoTDBStatement.java:305) ~[iotdb-jdbc-0.10.1.jar:0.10.1]
at org.apache.iotdb.jdbc.IoTDBStatement.executeQuery(IoTDBStatement.java:279) ~[iotdb-jdbc-0.10.1.jar:0.10.1]
at com.alibaba.druid.pool.DruidAbstractDataSource.validateConnection(DruidAbstractDataSource.java:1421) ~[druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1720) ~[druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:912) [druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1378) [druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1374) [druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:98) [druid-1.1.23.jar:1.1.23]
at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:43) [jfinal-4.9.jar:?]
at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:226) [jfinal-4.9.jar:?]
at testIotDB.main(testIotDB.java:26) [test-classes/:?]

2020-10-28 16:59:06.132-[Thread: main]
[ERROR]-{dataSource-1} init error
org.apache.iotdb.jdbc.IoTDBSQLException: 401: meet error while parsing SQL to physical plan: {}line 1:8 mismatched input '' expecting {FROM, ',', '.'}
at org.apache.iotdb.jdbc.IoTDBStatement.executeQuerySQL(IoTDBStatement.java:305) ~[iotdb-jdbc-0.10.1.jar:0.10.1]
at org.apache.iotdb.jdbc.IoTDBStatement.executeQuery(IoTDBStatement.java:279) ~[iotdb-jdbc-0.10.1.jar:0.10.1]
at com.alibaba.druid.pool.DruidAbstractDataSource.validateConnection(DruidAbstractDataSource.java:1421) ~[druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1720) ~[druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:912) [druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1378) [druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1374) [druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:98) [druid-1.1.23.jar:1.1.23]
at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:43) [jfinal-4.9.jar:?]
at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:226) [jfinal-4.9.jar:?]
at testIotDB.main(testIotDB.java:26) [test-classes/:?]

2020-10-28 16:59:06.135-[Thread: main]
[ERROR]-[main]: org.apache.iotdb.jdbc.IoTDBSQLException: 401: meet error while parsing SQL to physical plan: {}line 1:8 mismatched input '' expecting {FROM, ',', '.'}
com.jfinal.plugin.activerecord.ActiveRecordException: org.apache.iotdb.jdbc.IoTDBSQLException: 401: meet error while parsing SQL to physical plan: {}line 1:8 mismatched input '' expecting {FROM, ',', '.'}
at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:55) ~[jfinal-4.9.jar:?]
at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:226) ~[jfinal-4.9.jar:?]
at testIotDB.main(testIotDB.java:26) [test-classes/:?]
Caused by: org.apache.iotdb.jdbc.IoTDBSQLException: 401: meet error while parsing SQL to physical plan: {}line 1:8 mismatched input '' expecting {FROM, ',', '.'}
at org.apache.iotdb.jdbc.IoTDBStatement.executeQuerySQL(IoTDBStatement.java:305) ~[iotdb-jdbc-0.10.1.jar:0.10.1]
at org.apache.iotdb.jdbc.IoTDBStatement.executeQuery(IoTDBStatement.java:279) ~[iotdb-jdbc-0.10.1.jar:0.10.1]
at com.alibaba.druid.pool.DruidAbstractDataSource.validateConnection(DruidAbstractDataSource.java:1421) ~[druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1720) ~[druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:912) ~[druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1378) ~[druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1374) ~[druid-1.1.23.jar:1.1.23]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:98) ~[druid-1.1.23.jar:1.1.23]
at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:43) ~[jfinal-4.9.jar:?]
... 2 more


跟踪了一下,执行了一些 IotDB 数据库不识别的SQL语法,例如 "select 1" 这个能跳过么?

steven_lhcb_9527

2020-12-18 14:10

持续关注中

热门反馈

扫码入社