各位大佬,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)
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。