TDengine icon indicating copy to clipboard operation
TDengine copied to clipboard

操作数据库就会报错

Open liu18831337077 opened this issue 6 years ago • 10 comments

使用jdbc,并安装2.0版本客户端连接服务端时,可以连接成功,但是执行sql时会出现错误,以下为官方JdbcTemplate的Demo日志

Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException for SQL [create database if not exists db ]; SQL state []; error code [-2147483637]; TDengine Error: Unable to establish connection; nested exception is java.sql.SQLException: TDengine Error: Unable to establish connection at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:419) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:443) at com.taosdata.jdbc.App.main(App.java:21) Caused by: java.sql.SQLException: TDengine Error: Unable to establish connection at com.taosdata.jdbc.TSDBJNIConnector.executeQuery(TSDBJNIConnector.java:131) at com.taosdata.jdbc.TSDBStatement.execute(TSDBStatement.java:153) at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:435) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:408) ... 2 more

Process finished with exit code 1

liu18831337077 avatar Aug 20 '20 06:08 liu18831337077

TDengine Error: Unable to establish connection; nested exception is java.sql.SQLException: TDengine Error: Unable to establish connection at 日志显示似乎是没有连接成功。

hjxilinx avatar Aug 20 '20 07:08 hjxilinx

但是我尝试过错误的ip,启动的时候就会报错,都得不到Connection对象的的

liu18831337077 avatar Aug 20 '20 07:08 liu18831337077

把客户端日志贴上来我看看。默认目录:/var/log/taos/taos*

hjxilinx avatar Aug 20 '20 08:08 hjxilinx

您好已经连接您的同事了,正在解决中。

liu18831337077 avatar Aug 20 '20 08:08 liu18831337077

最后如何解决的 我也出现这种问题了

zhangyang1995 avatar Sep 28 '20 07:09 zhangyang1995

@sangshuduo @liu18831337077

zhangyang1995 avatar Sep 28 '20 08:09 zhangyang1995

还是没有连接上,要配置本地的hostname映射

liu18831337077 avatar Sep 28 '20 08:09 liu18831337077

用官网的windows版本的client使用taos -h 是可以连接上的 但是用到官方的springbootdemo 就不行了

zhangyang1995 avatar Sep 28 '20 08:09 zhangyang1995

还是没有连接上,要配置本地的hostname映射

配置的是server端的hostname吗

zhangyang1995 avatar Sep 28 '20 09:09 zhangyang1995

09/28 17:30:27.300739 0x7f53ff7fe700 CQ vgId:2, CQ is opened 09/28 17:30:27.301346 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal, 0 files are moved for restoration 09/28 17:30:27.301516 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal/wal0, it is created 09/28 17:30:27.301550 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal, it is open, level:1 fsyncPeriod:3000 09/28 17:30:27.301792 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, it is configured 09/28 17:30:27.301827 0x7f53ff7fe700 SYN vgId:2, this node is not configured 09/28 17:30:27.301832 0x7f53ff7fe700 SYN vgId:2, cleanup sync 09/28 17:30:27.301835 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, it is removed 09/28 17:30:27.301839 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, resource is freed 09/28 17:30:27.301844 0x7f53ff7fe700 VND ERROR vgId:2, failed to open sync module, replica:1 reason:Invalid Sync Configuration 09/28 17:30:27.301920 0x7f53ff7fe700 CQ vgId:2, stop all CQs 09/28 17:30:27.301924 0x7f53ff7fe700 CQ vgId:2, CQ is closed 09/28 17:30:27.301972 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal/wal0, it is removed 09/28 17:30:27.984632 0x7f53f6ffd700 DND 0x7f53c4001170, msg:heartbeat will be processed in mread queue 09/28 17:30:28.303829 0x7f53f67fc700 DND msg:status will be processed in mpeer queue 09/28 17:30:28.303886 0x7f53f67fc700 MND vgId:2, not exist in dnode:1 and status is ready, send create msg 09/28 17:30:28.303893 0x7f53f67fc700 MND vgId:2, send create all vnodes msg, numOfVnodes:1 db:0.log 09/28 17:30:28.303899 0x7f53f67fc700 MND vgId:2, index:0, send create vnode msg to dnode localhost:6030, ahandle:(nil) 09/28 17:30:28.304053 0x7f53ff7fe700 DND (nil), msg:create-vnode will be processed 09/28 17:30:28.304096 0x7f53ff7fe700 VND vgId:2, not exist 09/28 17:30:28.304107 0x7f53ff7fe700 DND vgId:2, create vnode msg is received 09/28 17:30:28.304203 0x7f53ff7fe700 VND vgId:2, save vnode cfg, replica:1 09/28 17:30:28.304241 0x7f53ff7fe700 VND vgId:2, save vnode cfg, nodeId:1 nodeEp:localhost:6030 09/28 17:30:28.304618 0x7f53ff7fe700 VND vgId:2, save vnode cfg successed 09/28 17:30:28.304673 0x7f53ff7fe700 VND vgId:2, vnode is created, walLevel:1 fsyncPeriod:3000 09/28 17:30:28.304822 0x7f53ff7fe700 VND vgId:2, read vnode cfg successfully, replcia:1 09/28 17:30:28.304856 0x7f53ff7fe700 VND vgId:2, dnode:1, localhost:6040 09/28 17:30:28.304999 0x7f53ff7fe700 VND vgId:2, read vnode version successfully, version:281 09/28 17:30:28.305101 0x7f53ff7fe700 DND pVnode:0x7f53d8001710, write queue:0x7f53d8000b80 is allocated 09/28 17:30:28.305108 0x7f53ff7fe700 DND pVnode:0x7f53d8001710, read queue:0x7f53d8000c00 is allocated 09/28 17:30:28.305117 0x7f53ff7fe700 CQ vgId:2, CQ is opened 09/28 17:30:28.305711 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal, 0 files are moved for restoration 09/28 17:30:28.305844 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal/wal0, it is created 09/28 17:30:28.305878 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal, it is open, level:1 fsyncPeriod:3000 09/28 17:30:28.306162 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, it is configured 09/28 17:30:28.306196 0x7f53ff7fe700 SYN vgId:2, this node is not configured 09/28 17:30:28.306202 0x7f53ff7fe700 SYN vgId:2, cleanup sync 09/28 17:30:28.306204 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, it is removed 09/28 17:30:28.306208 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, resource is freed 09/28 17:30:28.306213 0x7f53ff7fe700 VND ERROR vgId:2, failed to open sync module, replica:1 reason:Invalid Sync Configuration 09/28 17:30:28.306282 0x7f53ff7fe700 CQ vgId:2, stop all CQs 09/28 17:30:28.306333 0x7f53ff7fe700 CQ vgId:2, CQ is closed 09/28 17:30:28.306383 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal/wal0, it is removed 09/28 17:30:29.309253 0x7f53f67fc700 DND msg:status will be processed in mpeer queue 09/28 17:30:29.309319 0x7f53f67fc700 MND vgId:2, not exist in dnode:1 and status is ready, send create msg 09/28 17:30:29.309326 0x7f53f67fc700 MND vgId:2, send create all vnodes msg, numOfVnodes:1 db:0.log 09/28 17:30:29.309332 0x7f53f67fc700 MND vgId:2, index:0, send create vnode msg to dnode localhost:6030, ahandle:(nil) 09/28 17:30:29.309478 0x7f53ff7fe700 DND (nil), msg:create-vnode will be processed 09/28 17:30:29.309522 0x7f53ff7fe700 VND vgId:2, not exist 09/28 17:30:29.309533 0x7f53ff7fe700 DND vgId:2, create vnode msg is received 09/28 17:30:29.309666 0x7f53ff7fe700 VND vgId:2, save vnode cfg, replica:1 09/28 17:30:29.309709 0x7f53ff7fe700 VND vgId:2, save vnode cfg, nodeId:1 nodeEp:localhost:6030 09/28 17:30:29.310041 0x7f53ff7fe700 VND vgId:2, save vnode cfg successed 09/28 17:30:29.310123 0x7f53ff7fe700 VND vgId:2, vnode is created, walLevel:1 fsyncPeriod:3000 09/28 17:30:29.310201 0x7f53ff7fe700 VND vgId:2, read vnode cfg successfully, replcia:1 09/28 17:30:29.310235 0x7f53ff7fe700 VND vgId:2, dnode:1, localhost:6040 09/28 17:30:29.310383 0x7f53ff7fe700 VND vgId:2, read vnode version successfully, version:281 09/28 17:30:29.310536 0x7f53ff7fe700 DND pVnode:0x7f53d8001710, write queue:0x7f53d8000b80 is allocated 09/28 17:30:29.310565 0x7f53ff7fe700 DND pVnode:0x7f53d8001710, read queue:0x7f53d8000c00 is allocated 09/28 17:30:29.310572 0x7f53ff7fe700 CQ vgId:2, CQ is opened 09/28 17:30:29.311182 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal, 0 files are moved for restoration 09/28 17:30:29.311316 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal/wal0, it is created 09/28 17:30:29.311367 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal, it is open, level:1 fsyncPeriod:3000 09/28 17:30:29.311646 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, it is configured 09/28 17:30:29.311680 0x7f53ff7fe700 SYN vgId:2, this node is not configured 09/28 17:30:29.311685 0x7f53ff7fe700 SYN vgId:2, cleanup sync 09/28 17:30:29.311688 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, it is removed 09/28 17:30:29.311692 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, resource is freed 09/28 17:30:29.311697 0x7f53ff7fe700 VND ERROR vgId:2, failed to open sync module, replica:1 reason:Invalid Sync Configuration 09/28 17:30:29.311797 0x7f53ff7fe700 CQ vgId:2, stop all CQs 09/28 17:30:29.311840 0x7f53ff7fe700 CQ vgId:2, CQ is closed 09/28 17:30:29.311893 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal/wal0, it is removed 09/28 17:30:29.489348 0x7f53f77fe700 DND 0x7f53c4001170, msg:heartbeat will be processed in mread queue 09/28 17:30:30.314417 0x7f53f67fc700 DND msg:status will be processed in mpeer queue 09/28 17:30:30.314473 0x7f53f67fc700 MND vgId:2, not exist in dnode:1 and status is ready, send create msg 09/28 17:30:30.314480 0x7f53f67fc700 MND vgId:2, send create all vnodes msg, numOfVnodes:1 db:0.log 09/28 17:30:30.314497 0x7f53f67fc700 MND vgId:2, index:0, send create vnode msg to dnode localhost:6030, ahandle:(nil) 09/28 17:30:30.314713 0x7f53ff7fe700 DND (nil), msg:create-vnode will be processed 09/28 17:30:30.314756 0x7f53ff7fe700 VND vgId:2, not exist 09/28 17:30:30.314767 0x7f53ff7fe700 DND vgId:2, create vnode msg is received 09/28 17:30:30.314862 0x7f53ff7fe700 VND vgId:2, save vnode cfg, replica:1 09/28 17:30:30.314899 0x7f53ff7fe700 VND vgId:2, save vnode cfg, nodeId:1 nodeEp:localhost:6030 09/28 17:30:30.315249 0x7f53ff7fe700 VND vgId:2, save vnode cfg successed 09/28 17:30:30.315353 0x7f53ff7fe700 VND vgId:2, vnode is created, walLevel:1 fsyncPeriod:3000 09/28 17:30:30.315448 0x7f53ff7fe700 VND vgId:2, read vnode cfg successfully, replcia:1 09/28 17:30:30.315549 0x7f53ff7fe700 VND vgId:2, dnode:1, localhost:6040 09/28 17:30:30.315675 0x7f53ff7fe700 VND vgId:2, read vnode version successfully, version:281 09/28 17:30:30.315724 0x7f53ff7fe700 DND pVnode:0x7f53d8001710, write queue:0x7f53d8000b80 is allocated 09/28 17:30:30.315730 0x7f53ff7fe700 DND pVnode:0x7f53d8001710, read queue:0x7f53d8000c00 is allocated 09/28 17:30:30.315736 0x7f53ff7fe700 CQ vgId:2, CQ is opened 09/28 17:30:30.316330 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal, 0 files are moved for restoration 09/28 17:30:30.316479 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal/wal0, it is created 09/28 17:30:30.316512 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal, it is open, level:1 fsyncPeriod:3000 09/28 17:30:30.316758 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, it is configured 09/28 17:30:30.316792 0x7f53ff7fe700 SYN vgId:2, this node is not configured 09/28 17:30:30.316798 0x7f53ff7fe700 SYN vgId:2, cleanup sync 09/28 17:30:30.316800 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, it is removed 09/28 17:30:30.316804 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, resource is freed 09/28 17:30:30.316809 0x7f53ff7fe700 VND ERROR vgId:2, failed to open sync module, replica:1 reason:Invalid Sync Configuration 09/28 17:30:30.316879 0x7f53ff7fe700 CQ vgId:2, stop all CQs 09/28 17:30:30.316889 0x7f53ff7fe700 CQ vgId:2, CQ is closed 09/28 17:30:30.316963 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal/wal0, it is removed 09/28 17:30:30.994615 0x7f53f6ffd700 DND 0x7f53c4001170, msg:heartbeat will be processed in mread queue 09/28 17:30:31.318827 0x7f53f67fc700 DND msg:status will be processed in mpeer queue 09/28 17:30:31.318883 0x7f53f67fc700 MND vgId:2, not exist in dnode:1 and status is ready, send create msg 09/28 17:30:31.318890 0x7f53f67fc700 MND vgId:2, send create all vnodes msg, numOfVnodes:1 db:0.log 09/28 17:30:31.318896 0x7f53f67fc700 MND vgId:2, index:0, send create vnode msg to dnode localhost:6030, ahandle:(nil) 09/28 17:30:31.318991 0x7f53ff7fe700 DND (nil), msg:create-vnode will be processed 09/28 17:30:31.318999 0x7f53ff7fe700 VND vgId:2, not exist 09/28 17:30:31.319006 0x7f53ff7fe700 DND vgId:2, create vnode msg is received 09/28 17:30:31.319101 0x7f53ff7fe700 VND vgId:2, save vnode cfg, replica:1 09/28 17:30:31.319139 0x7f53ff7fe700 VND vgId:2, save vnode cfg, nodeId:1 nodeEp:localhost:6030 09/28 17:30:31.319515 0x7f53ff7fe700 VND vgId:2, save vnode cfg successed 09/28 17:30:31.319607 0x7f53ff7fe700 VND vgId:2, vnode is created, walLevel:1 fsyncPeriod:3000 09/28 17:30:31.319718 0x7f53ff7fe700 VND vgId:2, read vnode cfg successfully, replcia:1 09/28 17:30:31.319732 0x7f53ff7fe700 VND vgId:2, dnode:1, localhost:6040 09/28 17:30:31.319808 0x7f53ff7fe700 VND vgId:2, read vnode version successfully, version:281 09/28 17:30:31.319858 0x7f53ff7fe700 DND pVnode:0x7f53d8001710, write queue:0x7f53d8000b80 is allocated 09/28 17:30:31.319864 0x7f53ff7fe700 DND pVnode:0x7f53d8001710, read queue:0x7f53d8000c00 is allocated 09/28 17:30:31.319870 0x7f53ff7fe700 CQ vgId:2, CQ is opened 09/28 17:30:31.320531 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal, 0 files are moved for restoration 09/28 17:30:31.320661 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal/wal0, it is created 09/28 17:30:31.320678 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal, it is open, level:1 fsyncPeriod:3000 09/28 17:30:31.320963 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, it is configured 09/28 17:30:31.320997 0x7f53ff7fe700 SYN vgId:2, this node is not configured 09/28 17:30:31.321002 0x7f53ff7fe700 SYN vgId:2, cleanup sync 09/28 17:30:31.321005 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, it is removed 09/28 17:30:31.321009 0x7f53ff7fe700 SYN vgId:2 peer:localhost:6040, resource is freed 09/28 17:30:31.321013 0x7f53ff7fe700 VND ERROR vgId:2, failed to open sync module, replica:1 reason:Invalid Sync Configuration 09/28 17:30:31.321083 0x7f53ff7fe700 CQ vgId:2, stop all CQs 09/28 17:30:31.321094 0x7f53ff7fe700 CQ vgId:2, CQ is closed 09/28 17:30:31.321142 0x7f53ff7fe700 WAL wal:/var/lib/taos/vnode/vnode2/wal/wal0, it is removed

zhangyang1995 avatar Sep 28 '20 09:09 zhangyang1995