MariaDB存储过程异常信息:意外的流结束,读取0字节时发生错误
<p>我们在MariaDB中有一个存储过程,在服务器上运行良好,但是当我们使用JDBC从客户端运行时,我们可以获取到前几行,但是后面总是出现以下错误:</p>
<pre class="brush:php;toolbar:false;">unexpected end of stream, read 0 bytes from 4 (socket was closed by server)</pre>
<p>表<code>loan_balances2</code>不是太大,大约有600K行。这是存储过程,你看到有什么问题吗?谢谢!</p>
<pre class="brush:php;toolbar:false;">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</pre></p>