MariaDB預存程序異常訊息:意外的流結束,讀取0位元組時發生錯誤
P粉004287665
2023-08-26 22:16:32
<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>
通常是net_write_timeout。如果您的應用程式無法以伺服器寫入速度讀取數據,伺服器將關閉套接字。 net_write_timeout是伺服器嘗試傳送結果集的時間限制,以秒為單位。您可以增加該限制,這是會話變數。這也出現在MariaDB JDBC的常見問題解答。