【问题标题】:JNI ERROR (2354): JNI connection is NULL when I use JDBC to connect TDengineJNI ERROR (2354): 当我使用 JDBC 连接 TDengine 时,JNI 连接为 NULL
【发布时间】:2021-09-24 12:05:50
【问题描述】:

我正在做一个项目,使用 Windows 中的 JDBC 连接到在 Linux 上运行的 TDengine 数据库。

配置如下:

spring.datasource.driver-class-name=com.taosdata.jdbc.TSDBDriver
spring.datasource.url=jdbc:TAOS://192.168.2.58:6030/test?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
spring.datasource.username=root
spring.datasource.password=taosdata

我也调查了TDengine的日志。

06/29 18:29:30.630000 00018224 TSC starting to initialize TAOS client ...
06/29 18:29:30.630000 00018224 TSC Local End Point is:DESKTOP-PEO5CFV:6030
06/29 18:29:30.630000 00018224 UTL tsc scheduler is initialized, numOfThreads:6
06/29 18:29:30.630000 00018224 TMR ttimer monotonic clock source:POSIX clock_gettime
06/29 18:29:30.630000 00018224 UTL tmr scheduler is initialized, numOfThreads:1
06/29 18:29:30.631000 00018224 TSC TableMeta:0000016FE156BF40
06/29 18:29:30.631000 00018224 TSC client is initialized successfully
06/29 18:29:30.631000 00018224 UTL pool:0000016FE16D1CB0 is setup, maxId:5000
06/29 18:29:30.631000 00018224 TMR ttimer monotonic clock source:POSIX clock_gettime
06/29 18:29:30.631000 00018224 UTL open udp socket:0x0:0
06/29 18:29:30.631000 00018224 UTL open udp socket:0x0:0
06/29 18:29:30.631000 00018224 UTL open udp socket:0x0:0
06/29 18:29:30.631000 00018224 UTL open udp socket:0x0:0
06/29 18:29:30.631000 00016360 RPC TSC UDP thread is created, index:1
06/29 18:29:30.631000 00004944 RPC TSC UDP thread is created, index:0
06/29 18:29:30.631000 00018224 UTL open udp socket:0x0:0
06/29 18:29:30.631000 00016308 RPC TSC UDP thread is created, index:2
06/29 18:29:30.631000 00018224 UTL open udp socket:0x0:0
06/29 18:29:30.631000 00011648 RPC TSC UDP thread is created, index:3
06/29 18:29:30.631000 00018224 RPC TSC UDP connection is initialized, ip:0:0 threads:6
06/29 18:29:30.631000 00018224 RPC TSC rpc is opened, threads:6 sessions:5000
06/29 18:29:30.631000 00008320 RPC TSC UDP thread is created, index:4
06/29 18:29:30.631000 00018224 UTL cache:rpcObj, key:00000017E0BFA2A0, 0000016FE14D6C50 added into cache, added:1624962570631, expire:1624962575631, totalNum:1 totalSize:617bytes size:520bytes
06/29 18:29:30.631000 00018224 TSC 0000016FE1A401E0 new SqlObj from 0000016FE19F3950, total in tscObj:1, total:1
06/29 18:29:30.631000 00018224 TSC 0000016FE1A401E0 SQL cmd:connect will be processed, name:, type:0
06/29 18:29:30.631000 00000868 RPC TSC UDP thread is created, index:5
06/29 18:29:30.631000 00018224 RPC TSC 0000016FE3DE81B8 client connection is allocated, uid:0xe3df2b5e
06/29 18:29:30.631000 00018224 RPC TSC UDP connection is setup, ip:6cdf6527:6030 localPort:63914
06/29 18:29:30.631000 00018224 RPC TSC 0000016FE3DE81B8 0000000000000002, connect is sent to 39.101.223.108:6030, len:377 sig:0x01000000:0x00000000:26895
06/29 18:29:31.636000 00019936 RPC TSC 0000016FE3DE81B8 0000000000000002, expected connect-rsp is not received
06/29 18:29:31.636000 00019936 RPC TSC 0000016FE3DE81B8 0000000000000002, re-send msg:connect to 39.101.223.108:6030
06/29 18:29:31.636000 00019936 RPC TSC 0000016FE3DE81B8 0000000000000002, connect is sent to 39.101.223.108:6030, len:377 sig:0x01000000:0x00000000:26895
06/29 18:29:32.641000 00019936 RPC TSC 0000016FE3DE81B8 0000000000000002, expected connect-rsp is not received
06/29 18:29:32.641000 00019936 RPC TSC 0000016FE3DE81B8 0000000000000002, re-send msg:connect to 39.101.223.108:6030
06/29 18:29:32.641000 00019936 RPC TSC 0000016FE3DE81B8 0000000000000002, connect is sent to 39.101.223.108:6030, len:377 sig:0x01000000:0x00000000:26895
06/29 18:29:33.646000 00019936 RPC TSC 0000016FE3DE81B8 0000000000000002, expected connect-rsp is not received
06/29 18:29:33.646000 00019936 RPC TSC 0000016FE3DE81B8 0000000000000002, re-send msg:connect to 39.101.223.108:6030
06/29 18:29:33.646000 00019936 RPC TSC 0000016FE3DE81B8 0000000000000002, connect is sent to 39.101.223.108:6030, len:377 sig:0x01000000:0x00000000:26895

我不知道发生了什么。有人可以提示如何解决它吗?

【问题讨论】:

    标签: java database jdbc time-series


    【解决方案1】:

    这个异常一般是网络配置导致的,客户端时区与服务器客户端不匹配。 尝试使用taos客户端连接服务器。

    【讨论】:

      【解决方案2】:

      在您的 JDBC 连接字符串中,使用主机名而不是 IP 地址:

      jdbc:TAOS://DESKTOP-PEO5CFV:6030/test?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-06-30
        • 1970-01-01
        • 2021-10-06
        • 2015-02-08
        • 2010-09-15
        • 2012-10-23
        • 2013-07-15
        • 1970-01-01
        相关资源
        最近更新 更多