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

the first time connection to TDengine failed,second time work #24069

Open 123sdfa opened 11 months ago

123sdfa commented 11 months ago

使用druid,每过5、6分钟,第一次连接TDengine就不行,要第二次才可以,查看druid发现连接池是空的,MySQL没这个问题,这是为啥呢?下面是我的druid配置 59174fcc77f8e67faca02fb7cde9f2a

yu285 commented 11 months ago

麻烦提供下数据库的版本、驱动的版本。

123sdfa commented 11 months ago

数据库和驱动都是:3.2.1.0

yu285 commented 11 months ago

驱动更换到 3.2.7 再试试

123sdfa commented 11 months ago

还是不行呢

yu285 commented 11 months ago

第一次连接TDengine 报错截图贴一下

123sdfa commented 11 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