taosdata / TDengine

High-performance, scalable time-series database designed for Industrial IoT (IIoT) scenarios
https://tdengine.com
GNU Affero General Public License v3.0
23.39k stars 4.86k forks source link

connection between dynamic-datasource+ Druid and TDengine issue #24122

Open 123sdfa opened 10 months ago

123sdfa commented 10 months ago

使用dynamic-datasource和Druid连接TDengine,刚启动的时候没问题,10多分钟后再次查询就不行了,报下面的错误,能帮忙看看吗? Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 60007, active 0, maxActive 5, creating 1, createElapseMillis 120031 at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:84) at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:80) at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:67) at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:345) at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:89) at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:64) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:333) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:158) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:110) at com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor.willDoQuery(PaginationInnerInterceptor.java:135) at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:75) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59) at com.sun.proxy.$Proxy341.query(Unknown Source) 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.Invocation.proceed(Invocation.java:49) at com.github.yulichang.interceptor.MPJInterceptor.intercept(MPJInterceptor.java:76) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59) at com.sun.proxy.$Proxy341.query(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:154) ... 199 common frames omitted Caused by: com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 60007, active 0, maxActive 5, creating 1, createElapseMillis 120031 at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1871) at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1494) at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5058) at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:704) at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5054) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1469) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1459) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:83) at com.baomidou.dynamic.datasource.ds.ItemDataSource.getConnection(ItemDataSource.java:56) at com.baomidou.dynamic.datasource.ds.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:55) at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:160) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:118) at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81) ... 220 common frames omitted

123sdfa commented 10 months ago

bb23f0f2b6aab6f5f3a6b4599688b1f4

123sdfa commented 10 months ago

数据库版本是:3.2.1.0 驱动版本是3.2.7

xufh2016 commented 10 months ago

我用6030端口,一直连接不上,转为6041可以建立连接。是需要安装其他插件吗?我用的数据库版本也是3.2.1.0

123sdfa commented 10 months ago

我用6030端口,一直连接不上,转为6041可以建立连接。是需要安装其他插件吗?我用的数据库版本也是3.2.1.0

6030要安装客户端驱动

123sdfa commented 10 months ago

用TAOS-RS就没问题了,奇怪

xufh2016 commented 10 months ago

使用TSDBDriver作为驱动器时,需要本地有libtaos.io文件(咨询官方的结果,官方建议使用rest方式)