mysql MariaDB存储过程引发“流意外结束,从4读取0个字节”

qzwqbdag  于 2023-06-28  发布在  Mysql
关注(0)|答案(1)|浏览(240)

我们在MariaDB中有一个存储过程,它在服务器上运行良好,但是当我们从客户端使用JDBC运行它时,我们得到了第一行,但后来它总是失败:

unexpected end of stream, read 0 bytes from 4 (socket was closed by server)

loan_balances2不是太大,大约600 K行。这是存储过程,您看到任何问题了吗?谢谢!

CREATE PROCEDURE `get_loan_balances_sample`()

BEGIN

drop table if exists all_loan_ids;
drop table if exists random_loan_ids;

create table all_loan_ids as select distinct loan_id from loan_balances2;
create table random_loan_ids as select * from all_loan_ids order by RAND() limit 50;

SELECT * FROM loan_balances2
where loan_id in (select Loan_ID from random_loan_ids)
order by Loan_ID, balance_date;

END
hwamh0ep

hwamh0ep1#

通常是net_write_timeout。如果应用程序阅读数据的速度不如服务器写入数据的速度快,则服务器将关闭套接字。net_write_timeout时间限制,以秒为单位,表示服务器在尝试发送结果集时可以停留的时间。您可以增加该限制,它是一个会话变量。这也出现在MariaDB JDBC的FAQ中

相关问题