java.sql.SQLException: 無法從通訊端讀取更多的資料(mybatis 插入時),mybatis

來源:互聯網
上載者:User

java.sql.SQLException: 無法從通訊端讀取更多的資料(mybatis 插入時),mybatis



今天  做mybatis 的批量插入的時候  出現

 java.sql.SQLException: 無法從通訊端讀取更多的資料   的錯誤


解決方案:

由於批量插入的資料過大,需要分批次的插入。

List<IdentificationData> insertList = new ArrayList<IdentificationData>();
for (IdentificationData domain : list) {
insertList.add(domain);
//批量插入的資料太多, 沒500條插入一次
if (insertList.size() == 500) {
identificationDataMapper.insertList(insertList);
insertList = new ArrayList<IdentificationData>();
}
}
if (insertList.size() > 0) {
identificationDataMapper.insertList(insertList);
}

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.