第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

將 80000 左右的大數(shù)據(jù)插入到 postgres 數(shù)據(jù)庫中,Java 失敗

將 80000 左右的大數(shù)據(jù)插入到 postgres 數(shù)據(jù)庫中,Java 失敗

慕工程0101907 2021-08-19 22:27:49
我有以下file.txt參考這篇文章。它可能包含多達(dá) 400,000 個(gè)條目,我需要將它們插入到數(shù)據(jù)庫中,但是對(duì)于大約 80000 到最大 100,000 的文件,該過程成功但如果超出則失敗。問題可能出在寫入數(shù)據(jù)庫的最后一個(gè)循環(huán)中,F(xiàn)ILETYPE: STUDENTFORMATVERSION: 1.2 ACTION: REPLACEALLCOLUMNS: NAME,SURNAME,AGE,SEX"raj","jonson",17,"M""Rita","Sweety",17,"F"這是我的示例代碼//入口點(diǎn)public RestResponse provisionStudent(MultipartFormDataInput input) {    long processed = 0L;    HashMap<String, String> columnMaping = new HashMap<String, String>();    //mapping here as the column name is not same as in the database    columnMaping.put("NAME","name");    columnMaping.put("surname","s_name");    columnMaping.put("AGE","age");    columnMaping.put("SEX","mf");    try {        String lineRead;        List<Map<String, String>> listheader = new ArrayList<>();        Map<String, String> obj = new LinkedHashMap<>();        ArrayList<String> body = new ArrayList<String>();        InputStream result;        //checking if file contain data        if (input == null || input.getParts() == null || input.getParts().isEmpty()) {            throw new IllegalArgumentException("Multipart request is empty");        }        if (input.getParts().size() == 1) {            InputPart filePart = input.getParts().iterator().next();            result = filePart.getBody(InputStream.class, null);        } else {            result = input.getFormDataPart("file", InputStream.class, null);        }        BufferedReader httpResponseReader = new BufferedReader(new InputStreamReader(result));        // reading the header part into obj and the body part in array list body        while ((lineRead = httpResponseReader.readLine()) != null) {            if (lineRead.contains(":")) {                String[] headervalues = lineRead.replace(" ", "").split(":");                obj.put(headervalues[0], headervalues[1]);            } else {                if (lineRead.length() > 0) body.add(lineRead.replace(" ", ""));            }        }
查看完整描述

1 回答

?
素胚勾勒不出你

TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超9個(gè)贊

也許您在服務(wù)器端超時(shí),請(qǐng)嘗試將 statement_timeout 設(shè)置得更高。您應(yīng)該檢查許多超時(shí)選項(xiàng)。


查看完整回答
反對(duì) 回復(fù) 2021-08-19
  • 1 回答
  • 0 關(guān)注
  • 283 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)