1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

ExecuteUpdate stuck with insert sql in Java

Discussão em 'StackOverflow' iniciado por fdantas, Abril 6, 2017.

  1. fdantas

    fdantas Administrator Moderador

    I am using "com.ddtek.jdbc.openedge.OpenEdgeDriver" to execute sql queries in java. Because application running with progress DB. I execute insert sql statement as follows.

    String sqlString="INSERT INTO PUB.hrlh (frmaid, grgrid, kwalid, klrnid, varid, rkeus, rolhid, genrol, prdcid, indate, levrid,"
    + " levrnaam, initlengte, lengte, efflengte, breedte, verfbad, krimpl, krimpb, prijs, barcode, specif, Rek, kolom, nivo, "
    + "pos, palet, edoms, diphid, seizid, stuknr, ref, swprt, beshid, beslid, volgnr, reflevnota, crdate, crtime, cruscd, alfa, "
    + "prijsfrm, mntnid, levnota, pakhid, snyhid, intbarc, divhid, snijln, reden, crsrt, vlgnr,"
    + " hcruscd,hcrtime,chdate,hcrdate) VALUES(" + roll.getFrmaid()+ ",'"+ roll.getGrgrid()+"','"+ roll.getKwalid()+"','"+ roll.getKlrnid()+
    "',"+ roll.getVarid()+","+ roll.getRkeus()+","+ roll.getRolhid()+","+roll.getGenrol()+",'"+ roll.getPrdcid()+ "',"+(roll.getIndate()==null?null:"{ d '"+ roll.getIndate()+"' }")+
    ", "+ roll.getLevrid()+",'"+ SystemPara.replaceApostrophe(roll.getLevrnaam())+"',"+ roll.getInitlengte()+","+ roll.getLengte()+","+ roll.getEfflengte()+
    ","+ roll.getBreedte()+",'"+ roll.getVerfbad()+"',"+ roll.getKrimpl()+","+ roll.getKrimpb()+","+ roll.getPrijs()+","+ roll.getBarcode()+
    ",'"+ roll.getSpecif()+"','"+ roll.getRek()+"',"+ roll.getKolom()+","+roll.getNivo()+",'"+ roll.getPos()+"','"+ roll.getPalet()+"','"+ SystemPara.replaceApostrophe(edoms)+
    "',"+ roll.getDiphid()+",'"+ roll.getSeizid()+"','"+ roll.getStuknr()+"','"+roll.getRef()+"',"+SystemPara.getIntFromBoolean(roll.getSwprt())+","+roll.getBeshid()+","+ roll.getBeslid()+
    ","+ roll.getVolgnr()+",'"+ roll.getReflevnota()+"',{ d '"+ SystemPara.getNewDate()+"'},"+ SystemPara.getNewTime().longValue()+",'"+ roll.getCruscd()+"','"+ roll.getAlfa()+
    "',"+ roll.getPrijsfrm()+","+ roll.getMntnid()+",'"+ roll.getLevnota()+"',"+ roll.getPakhid()+","+ roll.getSnyhid()+","+ roll.getIntbarc()+
    ","+ roll.getDivhid()+","+ roll.getSnijln()+",'"+ roll.getReden()+"','"+ roll.getCrsrt()+"',"+ roll.getVlgnr()+
    ",'"+ roll.getHcruscd()+"',"+roll.getHcrtime() +","+ (roll.getChdate()==null?null:"{ d '"+roll.getChdate()+"'}") +","+
    (roll.getHcrdate()==null?null:"{ d '"+roll.getHcrdate()+"'}")+")";

    Statement stmt = con.createStatement();
    stmt.executeUpdate(sqlString);


    But this statement not execute and stuck at the executeUpdate() method.

    I found the reason for this as "edoms" field in above query has 750 character string. "edoms" field contains following text.

    Dear Ruwan,

    We have received these 50mtr free of charge, so please enter this fabric as sample.

    Brgds
    Stefka

    Van: abcd silva
    Verzonden: woensdag 11 mei 2016 9:38
    Aan: ’ruwan’; ’chandima’
    CC: Frank Vermeulen; ’Serge’; ’Asanji’; ’samanthika’; ’patrice’; ’Udaya’; ’osanda’
    Onderwerp: RE: SO prices Intex

    Dear saman,

    I am checking this, reverting back asap.

    Brgds
    Bert

    Van: ruwan [mailto:saman@test.com]
    Verzonden: woensdag 11 mei 2016 8:27
    Aan: ’saman’; Bert ven; ’chandima’
    CC: Frank Vermeulen; ’Serge’; ’Asanji’; ’samanthika’; ’patrice’; ’Udaya’; ’osanda’
    Onderwerp: RE: SO prices Intex

    Dear stefka

    We need to create GRN for this received roll. If you want to make payment for this, pls. mail me invoice for thi


    I changed above query with prepared statements as follows. But not solve above issue.

    String sql="INSERT INTO PUB.hrlh (frmaid, grgrid, kwalid, klrnid, varid, rkeus, rolhid, genrol, prdcid, indate, levrid,"
    + " levrnaam, initlengte, lengte, efflengte, breedte, verfbad, krimpl, krimpb, prijs, barcode, specif, Rek, kolom, nivo, "
    + "pos, palet, edoms, diphid, seizid, stuknr, ref, swprt, beshid, beslid, volgnr, reflevnota, crdate, crtime, cruscd, alfa, "
    + "prijsfrm, mntnid, levnota, pakhid, snyhid, intbarc, divhid, snijln, reden, crsrt, vlgnr,"
    + " hcruscd,hcrtime,chdate,hcrdate) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,"
    + "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
    PreparedStatement pt = con.getConnection().prepareStatement(sql);
    pt.setInt(1, roll.getFrmaid());
    pt.setString(2, roll.getGrgrid());
    pt.setString(3, roll.getKwalid());
    pt.setString(4, roll.getKlrnid());
    pt.setInt(5, roll.getVarid());
    pt.setInt(6, roll.getRkeus());
    pt.setInt(7, roll.getRolhid());
    pt.setInt(8, roll.getGenrol());
    pt.setString(9, roll.getPrdcid());
    pt.setDate(10, null);
    pt.setInt(11, roll.getLevrid());
    pt.setString(12, "Test1");
    pt.setDouble(13, roll.getInitlengte());
    pt.setDouble(14, roll.getLengte());
    pt.setDouble(15, roll.getEfflengte());
    pt.setDouble(16, roll.getBreedte());
    pt.setString(17, roll.getVerfbad());
    pt.setDouble(18, roll.getKrimpl());
    pt.setDouble(19, roll.getKrimpb());
    pt.setDouble(20, roll.getPrijs());
    pt.setInt(21, roll.getBarcode());
    pt.setString(22, roll.getSpecif());
    pt.setString(23, roll.getRek());
    pt.setInt(24, roll.getKolom());
    pt.setInt(25, roll.getNivo());
    pt.setString(26, roll.getPos());
    pt.setString(27, roll.getPalet());
    pt.setString(28, roll.getEdoms());
    pt.setInt(29, roll.getDiphid());
    pt.setString(30, roll.getSeizid());
    pt.setString(31, roll.getStuknr());
    pt.setString(32, roll.getRef());
    pt.setBoolean(33, roll.getSwprt());
    pt.setInt(34, roll.getBeshid());
    pt.setInt(35, roll.getBeslid());
    pt.setInt(36, roll.getVolgnr());
    pt.setString(37, roll.getReflevnota());
    pt.setDate(38, null);
    pt.setLong(39, SystemPara.getNewTime().longValue());
    pt.setString(40, roll.getCruscd());
    pt.setString(41, roll.getAlfa());
    pt.setDouble(42, roll.getPrijsfrm());
    pt.setInt(43, roll.getMntnid());
    pt.setString(44, roll.getLevnota());
    pt.setInt(45, roll.getPakhid());
    pt.setInt(46, roll.getSnyhid());
    pt.setDouble(47, roll.getIntbarc());
    pt.setInt(48, roll.getDivhid());
    pt.setInt(49, roll.getSnijln());
    pt.setString(50, roll.getReden());
    pt.setString(51, roll.getCrsrt());
    pt.setInt(52, roll.getVlgnr());
    pt.setString(53, roll.getHcruscd());
    pt.setInt(54, (roll.getHcrtime()==null?0:roll.getHcrtime()));
    pt.setDate(55, null);
    pt.setDate(56, null);
    pt.executeUpdate();


    I did not get any exception. Execution stuck at the executeUpdate(). That's the issue.

    Please help me to solve this problem.

    Continue reading...

Compartilhe esta Página