TDengine ERROR (8000000b): 无法建立连接
TDengine ERROR (8000000b): Unable to establish connection
enter image description here正在学习在myBatis项目中使用taos JDBC,在使用TDengine提供的demo时。我遇到了无法建立连接的问题。
sql:insert into db1.t1(ts,temperature) values (now,23.23)
调用执行此 sql 命令时抛出异常。
我尝试在服务器上的命令行中 运行 sql ,没问题。
而 运行 在我的 windows 客户端上它失败了。
运行 环境
服务器:ubuntu 18.4 上的 TDengine 2.1.3.2
客户端:window x64
taos-jdbcdriver:2.0.32
日志信息
2021-07-22 16:00:48.116 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : ==> Preparing: drop table if exists temperature
2021-07-22 16:00:48.130 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : ==> Parameters:
2021-07-22 16:00:48.139 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : <== Updates: 0
2021-07-22 16:00:48.140 DEBUG 16276 --- [ main] c.t.e.m.m.T.createSuperTable : ==> Preparing: CREATE TABLE if not exists temperature(ts timestamp, temperature float) tags(location nchar(64), tbIndex int)
2021-07-22 16:00:48.141 DEBUG 16276 --- [ main] c.t.e.m.m.T.createSuperTable : ==> Parameters:
2021-07-22 16:00:48.161 DEBUG 16276 --- [ main] c.t.e.m.m.T.createSuperTable : <== Updates: 0
2021-07-22 16:00:48.163 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.164 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t0(String), 杭州(String), 0(Integer)
2021-07-22 16:00:48.226 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.227 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.228 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t1(String), 深圳(String), 1(Integer)
2021-07-22 16:00:48.242 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.243 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.243 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t2(String), 上海(String), 2(Integer)
2021-07-22 16:00:48.265 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.266 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.266 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t3(String), 上海(String), 3(Integer)
2021-07-22 16:00:48.286 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.287 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.287 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t4(String), 深圳(String), 4(Integer)
2021-07-22 16:00:48.301 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.302 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.302 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t5(String), 北京(String), 5(Integer)
2021-07-22 16:00:48.323 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.324 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.324 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t6(String), 杭州(String), 6(Integer)
2021-07-22 16:00:48.339 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.340 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.341 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t7(String), 深圳(String), 7(Integer)
2021-07-22 16:00:48.360 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.361 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.361 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t8(String), 深圳(String), 8(Integer)
2021-07-22 16:00:48.375 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.376 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.376 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t9(String), 北京(String), 9(Integer)
2021-07-22 16:00:48.403 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.423 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.insertOne : ==> Preparing: insert into t0(ts, temperature) values(?, ?)
2021-07-22 16:00:48.423 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.insertOne : ==> Parameters: 2020-11-11 00:00:00.0(Timestamp), 3.1568499(Float)
2021-07-22 16:00:57.045 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : ==> Preparing: drop table if exists temperature
2021-07-22 16:00:57.045 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : ==> Parameters:
2021-07-22 16:00:57.071 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : <== Updates: 0
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.sql.SQLException: TDengine ERROR (8000000b): Unable to establish connection
### The error may exist in com/taosdata/example/mybatisplusdemo/mapper/TemperatureMapper.java (best guess)
### The error may involve com.taosdata.example.mybatisplusdemo.mapper.TemperatureMapper.insertOne-Inline
### The error occurred while setting parameters
### SQL: insert into t0(ts, temperature) values(?, ?)
### Cause: java.sql.SQLException: TDengine ERROR (8000000b): Unable to establish connection
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
at com.sun.proxy.$Proxy63.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:58)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:62)
at com.sun.proxy.$Proxy78.insertOne(Unknown Source)
at com.taosdata.example.mybatisplusdemo.mapper.TemperatureMapperTest.before(TemperatureMapperTest.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access[=10=]0(ParentRunner.java:58)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.sql.SQLException: TDengine ERROR (8000000b): Unable to establish connection
at com.taosdata.jdbc.TSDBError.createSQLException(TSDBError.java:73)
at com.taosdata.jdbc.TSDBJNIConnector.executeQuery(TSDBJNIConnector.java:123)
at com.taosdata.jdbc.TSDBStatement.execute(TSDBStatement.java:85)
at com.taosdata.jdbc.TSDBPreparedStatement.execute(TSDBPreparedStatement.java:266)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
at com.sun.proxy.$Proxy89.execute(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
at com.sun.proxy.$Proxy88.update(Unknown Source)
at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doUpdate(MybatisSimpleExecutor.java:54)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
... 41 more
enter image description here
我已经在我的电脑上试过了这个演示。它工作正常。
unable to establish connection
这个异常总是由网络问题引起的。但是从你的日志信息来看,你似乎可以访问 TDengine.It 很难说是什么原因造成的。
我建议您可以打开调试标志,并尝试弄清楚那里发生了什么。
您按照以下步骤调试 TDengine 并阅读调试日志
这通常非常有用。
windows
{TDengine_home}/cfg/tao.cfg
添加“debugFlag 135”,然后再次运行您的演示代码并阅读您的客户端登录
{TDengine_home}/log/taoslog.*
找到你的 sql 就可以找到错误
异常日志显示错误发生在 statement.execute 期间。您应该已经成功创建了一个连接对象(例如,createConnection)。
at com.taosdata.jdbc.TSDBStatement.execute(TSDBStatement.java:85)
您是否在 URL 中使用了 IP 而不是主机名?请使用主机名,因为 Tdengine 最新版本需要主机名。它可能会在创建连接时静默失败并导致一些奇怪的问题。
其他一些原因可能在 Tdengine FAQ 中。
2. When encoutered with the error " Unable to establish connection ", what can I do?
enter image description here正在学习在myBatis项目中使用taos JDBC,在使用TDengine提供的demo时。我遇到了无法建立连接的问题。
sql:insert into db1.t1(ts,temperature) values (now,23.23)
调用执行此 sql 命令时抛出异常。
我尝试在服务器上的命令行中 运行 sql ,没问题。
而 运行 在我的 windows 客户端上它失败了。
运行 环境
服务器:ubuntu 18.4 上的 TDengine 2.1.3.2
客户端:window x64
taos-jdbcdriver:2.0.32
日志信息
2021-07-22 16:00:48.116 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : ==> Preparing: drop table if exists temperature
2021-07-22 16:00:48.130 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : ==> Parameters:
2021-07-22 16:00:48.139 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : <== Updates: 0
2021-07-22 16:00:48.140 DEBUG 16276 --- [ main] c.t.e.m.m.T.createSuperTable : ==> Preparing: CREATE TABLE if not exists temperature(ts timestamp, temperature float) tags(location nchar(64), tbIndex int)
2021-07-22 16:00:48.141 DEBUG 16276 --- [ main] c.t.e.m.m.T.createSuperTable : ==> Parameters:
2021-07-22 16:00:48.161 DEBUG 16276 --- [ main] c.t.e.m.m.T.createSuperTable : <== Updates: 0
2021-07-22 16:00:48.163 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.164 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t0(String), 杭州(String), 0(Integer)
2021-07-22 16:00:48.226 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.227 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.228 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t1(String), 深圳(String), 1(Integer)
2021-07-22 16:00:48.242 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.243 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.243 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t2(String), 上海(String), 2(Integer)
2021-07-22 16:00:48.265 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.266 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.266 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t3(String), 上海(String), 3(Integer)
2021-07-22 16:00:48.286 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.287 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.287 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t4(String), 深圳(String), 4(Integer)
2021-07-22 16:00:48.301 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.302 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.302 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t5(String), 北京(String), 5(Integer)
2021-07-22 16:00:48.323 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.324 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.324 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t6(String), 杭州(String), 6(Integer)
2021-07-22 16:00:48.339 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.340 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.341 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t7(String), 深圳(String), 7(Integer)
2021-07-22 16:00:48.360 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.361 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.361 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t8(String), 深圳(String), 8(Integer)
2021-07-22 16:00:48.375 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.376 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Preparing: create table ? using temperature tags( ?, ?)
2021-07-22 16:00:48.376 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : ==> Parameters: t9(String), 北京(String), 9(Integer)
2021-07-22 16:00:48.403 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.createTable : <== Updates: 0
2021-07-22 16:00:48.423 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.insertOne : ==> Preparing: insert into t0(ts, temperature) values(?, ?)
2021-07-22 16:00:48.423 DEBUG 16276 --- [ main] c.t.e.m.m.TemperatureMapper.insertOne : ==> Parameters: 2020-11-11 00:00:00.0(Timestamp), 3.1568499(Float)
2021-07-22 16:00:57.045 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : ==> Preparing: drop table if exists temperature
2021-07-22 16:00:57.045 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : ==> Parameters:
2021-07-22 16:00:57.071 DEBUG 16276 --- [ main] c.t.e.m.m.T.dropSuperTable : <== Updates: 0
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.sql.SQLException: TDengine ERROR (8000000b): Unable to establish connection
### The error may exist in com/taosdata/example/mybatisplusdemo/mapper/TemperatureMapper.java (best guess)
### The error may involve com.taosdata.example.mybatisplusdemo.mapper.TemperatureMapper.insertOne-Inline
### The error occurred while setting parameters
### SQL: insert into t0(ts, temperature) values(?, ?)
### Cause: java.sql.SQLException: TDengine ERROR (8000000b): Unable to establish connection
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
at com.sun.proxy.$Proxy63.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:58)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:62)
at com.sun.proxy.$Proxy78.insertOne(Unknown Source)
at com.taosdata.example.mybatisplusdemo.mapper.TemperatureMapperTest.before(TemperatureMapperTest.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access[=10=]0(ParentRunner.java:58)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.sql.SQLException: TDengine ERROR (8000000b): Unable to establish connection
at com.taosdata.jdbc.TSDBError.createSQLException(TSDBError.java:73)
at com.taosdata.jdbc.TSDBJNIConnector.executeQuery(TSDBJNIConnector.java:123)
at com.taosdata.jdbc.TSDBStatement.execute(TSDBStatement.java:85)
at com.taosdata.jdbc.TSDBPreparedStatement.execute(TSDBPreparedStatement.java:266)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
at com.sun.proxy.$Proxy89.execute(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
at com.sun.proxy.$Proxy88.update(Unknown Source)
at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doUpdate(MybatisSimpleExecutor.java:54)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
... 41 more
enter image description here
我已经在我的电脑上试过了这个演示。它工作正常。
unable to establish connection
这个异常总是由网络问题引起的。但是从你的日志信息来看,你似乎可以访问 TDengine.It 很难说是什么原因造成的。
我建议您可以打开调试标志,并尝试弄清楚那里发生了什么。
您按照以下步骤调试 TDengine 并阅读调试日志 这通常非常有用。 windows
{TDengine_home}/cfg/tao.cfg
添加“debugFlag 135”,然后再次运行您的演示代码并阅读您的客户端登录
{TDengine_home}/log/taoslog.*
找到你的 sql 就可以找到错误
异常日志显示错误发生在 statement.execute 期间。您应该已经成功创建了一个连接对象(例如,createConnection)。
at com.taosdata.jdbc.TSDBStatement.execute(TSDBStatement.java:85)
您是否在 URL 中使用了 IP 而不是主机名?请使用主机名,因为 Tdengine 最新版本需要主机名。它可能会在创建连接时静默失败并导致一些奇怪的问题。
其他一些原因可能在 Tdengine FAQ 中。
2. When encoutered with the error " Unable to establish connection ", what can I do?