MariaDB stored procedure exception information: Unexpected end of stream, error reading 0 bytes
<p>We have a stored procedure in MariaDB that runs fine on the server, but when we run it from the client using JDBC, we can get the first few rows, but always get the following error afterwards: </p> ;
<pre class="brush:php;toolbar:false;">unexpected end of stream, read 0 bytes from 4 (socket was closed by server)</pre>
<p>Table<code>loan_balances2</code> is not too big, about 600K rows. This is a stored procedure, do you see anything wrong with it? Thanks! </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>