ClickHouse-Native-JDBC
ClickHouse-Native-JDBC copied to clipboard
Connection is currently waiting for an insert operation, check your previous InsertStatement.
Environment
- OS version: centos
- JDK version:1.8
- ClickHouse Server version: 20.7.1.1
- ClickHouse Native JDBC version:2.5.4
- (Optional) Spark version: N/A
- (Optional) Other components' version: N/A
- Sprintboot+Mybatis+ClickHouse-Native-JDBC
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=20
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
spring.datasource.dynamic.primary=master
spring.datasource.dynamic.datasource.master.url=***
spring.datasource.dynamic.datasource.master.username=***
spring.datasource.dynamic.datasource.master.password=****
spring.datasource.dynamic.datasource.master.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.dynamic.datasource.ck.url=*****
spring.datasource.dynamic.datasource.ck.username=****
spring.datasource.dynamic.datasource.ck.password=****
spring.datasource.dynamic.datasource.ck.driver-class-name=com.github.housepower.jdbc.ClickHouseDriver
When I use JdbcTemplate batch insert to clickhouse,running for a few minutes, the following error occurs. How do I solve it?
Error logs
java.sql.SQLException: Connection is currently waiting for an insert operation, check your previous InsertStatement.
at com.github.housepower.jdbc.misc.Validate.isTrue(Validate.java:41)
at com.github.housepower.jdbc.ClickHouseConnection.sendQueryRequest(ClickHouseConnection.java:269)
at com.github.housepower.jdbc.statement.ClickHouseStatement.executeUpdate(ClickHouseStatement.java:92)
at com.github.housepower.jdbc.statement.ClickHouseStatement.executeQuery(ClickHouseStatement.java:100)
at com.github.housepower.jdbc.statement.ClickHouseStatement.execute(ClickHouseStatement.java:69)
at com.alibaba.druid.filter.FilterChainImpl.statement_execute(FilterChainImpl.java:3010)
at com.alibaba.druid.filter.FilterAdapter.statement_execute(FilterAdapter.java:2484)
at com.alibaba.druid.filter.FilterEventAdapter.statement_execute(FilterEventAdapter.java:188)
at com.alibaba.druid.filter.FilterChainImpl.statement_execute(FilterChainImpl.java:3008)
at com.alibaba.druid.filter.FilterAdapter.statement_execute(FilterAdapter.java:2484)
at com.alibaba.druid.filter.FilterEventAdapter.statement_execute(FilterEventAdapter.java:188)
at com.alibaba.druid.filter.FilterChainImpl.statement_execute(FilterChainImpl.java:3008)
at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.execute(StatementProxyImpl.java:147)
at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:632)
at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:409)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:376)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:418)
at com.github.modules.device.service.impl.AndroidServiceImpl.saveBatch(AndroidServiceImpl.java:79)
at com.baomidou.mybatisplus.extension.service.IService.saveBatch(IService.java:58)
at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$f8525d18.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at com.baomidou.dynamic.datasource.aop.DynamicDataSourceAnnotationInterceptor.invoke(DynamicDataSourceAnnotationInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
Steps to reproduce
Other descriptions
Sorry, we did not do tests for this drive with Sprintboot+Mybatis
. Currently, it may exist some bugs.
Sorry, we did not do tests for this drive with
Sprintboot+Mybatis
. Currently, it may exist some bugs.
Fisrt, i dont use Sprintboot+Mybatis, when i use jdbc Statement.execute(Insert_sql), face the same SQLException =-=
release v2.6.0 fix this ???
Fisrt, i dont use Sprintboot+Mybatis, when i use jdbc Statement.execute(Insert_sql), face the same SQLException =-=
This is because you are sharing connection in multi thread, the connection is not thread safe.
这个以后会支持 Sprintboot+Mybatis?
Will this support sprintboot + mybatis in the future?
Maybe it was a SQL syntax error, not a bug