'流意外结束,从 4 读取 0 个字节'由 MariaDB 存储过程抛出

问题描述 投票:0回答:1

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

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

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

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
java mysql jdbc mariadb
1个回答
1
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.