开发者社区 > 数据库 > 正文

求助!!delete 删除分片表报错:no database selected!!!!!!!!

各位大佬,mycat2搭建好,创建分片表后delete 删除分片表报错:no database selected,查询、修改、新增都正常,就删除报错,是什么原因?
建表语句如下:
CREATE TABLE db1.orders(
id BIGINT NOT NULL AUTO_INCREMENT,
order_type INT,
customer_id INT,
amount DECIMAL(10,2),
PRIMARY KEY(id),
KEY id (id)
)ENGINE=INNODB DEFAULT CHARSET=utf8
dbpartition BY mod_hash(customer_id) tbpartition BY mod_hash(customer_id)
tbpartitions 1 dbpartitions 4;

删除语句如下:
delete from db1.orders where id=1;

后台日志报错如下:
INFO | jvm 1 | 2024/04/10 11:51:09 | 2024-04-10 11:51:09,333[ERROR]io.vertx.core.impl.future.FutureImpl.?:?tryFail
INFO | jvm 1 | 2024/04/10 11:51:09 | java.sql.SQLException: No database selected
INFO | jvm 1 | 2024/04/10 11:51:09 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
INFO | jvm 1 | 2024/04/10 11:51:09 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
INFO | jvm 1 | 2024/04/10 11:51:09 | at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
INFO | jvm 1 | 2024/04/10 11:51:09 | at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
INFO | jvm 1 | 2024/04/10 11:51:09 | at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1092)
INFO | jvm 1 | 2024/04/10 11:51:09 | at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1040)
INFO | jvm 1 | 2024/04/10 11:51:09 | at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1347)
INFO | jvm 1 | 2024/04/10 11:51:09 | at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1025)
INFO | jvm 1 | 2024/04/10 11:51:09 | at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:255)
INFO | jvm 1 | 2024/04/10 11:51:09 | at io.mycat.newquery.NewMycatConnectionImpl.lambda$update$5(NewMycatConnectionImpl.java:374)
INFO | jvm 1 | 2024/04/10 11:51:09 | at io.vertx.core.impl.future.Transformation.onSuccess(Transformation.java:39)
INFO | jvm 1 | 2024/04/10 11:51:09 | at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
INFO | jvm 1 | 2024/04/10 11:51:09 | at io.vertx.core.impl.future.FutureImpl.addListener(FutureImpl.java:168)
INFO | jvm 1 | 2024/04/10 11:51:09 | at io.vertx.core.impl.future.FutureBase.transform(FutureBase.java:92)
INFO | jvm 1 | 2024/04/10 11:51:09 | at io.mycat.newquery.NewMycatConnectionImpl.update(NewMycatConnectionImpl.java:353)
INFO | jvm 1 | 2024/04/10 11:51:09 | at io.mycat.monitor.ThreadMycatConnectionImplWrapper.lambda$update$5(ThreadMycatConnectionImplWrapper.java:119)
INFO | jvm 1 | 2024/04/10 11:51:09 | at io.mycat.IOExecutor$1.lambda$executeBlocking$0(IOExecutor.java:33)
INFO | jvm 1 | 2024/04/10 11:51:09 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
INFO | jvm 1 | 2024/04/10 11:51:09 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
INFO | jvm 1 | 2024/04/10 11:51:09 | at java.lang.Thread.run(Thread.java:748)

展开
收起
35evaerpgia6i 2024-04-10 12:23:19 112 0
0 条回答
写回答
取消 提交回答

数据库领域前沿技术分享与交流

相关电子书

更多
GTD GLOBAL TERRORISM DATABASE 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载