ExecuteUpdate坚持使用Java中的insert sql

时间:2017-04-06 11:52:17

标签: java sql jdbc openedge

我使用“com.ddtek.jdbc.openedge.OpenEdgeDriver”在java中执行sql查询。因为应用程序与进度DB一起运行我按如下方式执行insert sql语句。

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);

但是这个语句没有执行并停留在executeUpdate()方法中。

我找到了这个的原因,因为上面查询中的“edoms”字段有750个字符串。 “edoms”字段包含以下文本。

    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

我用以下准备语句更改了上述查询。但不能解决上述问题。

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();

我没有得到任何例外。执行停留在executeUpdate()。这就是问题所在。

请帮我解决这个问题。

0 个答案:

没有答案