求救:DB28.1下开发java web应用的问题

开发环境:

       redflag server 4.1 + db2 8.1
       windows 2003 + weblogic 8.1 sp2 (我个人机器)

问题:
     开发出来的程序在app 连接方式下一点问题也没有。
    但在net 方式下,处理大批量数据插入时始终报错。错误信息如下:
  

   -----当前插入明细id:75353, 具体项目编号:3815,南兴四路路灯安装、土建工程
-----当前插入明细id:75354, 具体项目编号:3829,三圣河臭涌改造(南海大道~南六路)
-----当前插入明细id:75355, 具体项目编号:3840,三圣河臭涌改造(南六路~南七路)
-----当前插入明细id:75356, 具体项目编号:3863,2001年度修补道路沥青
-----当前插入明细id:75357, 具体项目编号:3872,南一路(南一桥以北 D海八西路)道路
、排水
- 添加明细错误信息2--:null
java.lang.NullPointerException
        at COM.ibm.db2.jdbc.net.SQLExceptionGenerator.addWarning(Unknown Source)

        at COM.ibm.db2.jdbc.net.SQLExceptionGenerator.check_return_code(Unknown
Source)
        at COM.ibm.db2.jdbc.net.SQLExceptionGenerator.check_return_code(Unknown
Source)
        at COM.ibm.db2.jdbc.net.DB2PreparedStatement.execute2(Unknown Source)
        at COM.ibm.db2.jdbc.net.DB2PreparedStatement.executeUpdate(Unknown Sourc
e)
        at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStateme
nt.java:94)
        at com.gever.pfms.budgetexe.index.dao.impl.IndexDetailDAOImpl.add(IndexD
etailDAOImpl.java:299)
        at com.gever.pfms.budgetexe.index.dao.impl.IndexDetailDAOImpl.add(IndexD
etailDAOImpl.java:429)
        at com.gever.pfms.budgetexe.index.bo.impl.IndexBOImpl.importAllBudget(In
dexBOImpl.java:157)
        at com.gever.pfms.budgetexe.index.action.IndexAction.importIndex(IndexAc
tion.java:101)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at cn.com.windy.struts.action.ActionBaseX.performMethod(ActionBaseX.java
:130)
        at cn.com.windy.struts.action.ActionBaseX.execute(ActionBaseX.java:58)
        at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:484)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:274)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:143
5)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:971)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:402)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
        at com.gever.pfms.util.SetCharacterEncodingFilter.doFilter(SetCharacterE
ncodingFilter.java:33)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6356)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:317)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3635)
        at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2585)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

   我的插入数据的程序如下:
   public int add(IndexDetailVO vo, Connection con) throws DefaultException,
      Exception {

      int ret = -1;
      PreparedStatement st = null;
      helper.setAutoClose(false);
      try {

          String sql = "INSERT INTO TINDEXDETAIL "
              + "(FID, FJTXMBH, FJTXMMC, FYEAR, FDWID, FYSKMID, FZCXMID, "
              + "FYWKSID, FZJLYBH, FQZHJID, FYT, FWJYJ, FWJLJ, FINMONEY, FOUTMONEY,"
              + "FSFZFCG, FSFDAP, FSFBMYS, FZBLYID, FZJXZID, FJFLXID, FTJLXID,"
              + "FZY, FTYPE, FZID, FGROUPID, FDRIECT, FOLDINDEX, FDOWNSTATE, FLAG)"
              + "VALUES "
              + "(?, ?, ?, ?, ?, ?, ?, "
              + "?, ?, ?, ?, ?, ?, ?, ?,"
              + "?, ?, ?, ?, ?, ?, ?,"
              + "?, ?, ?, ?, ?, ?, ?, ?)";

          if (con==null)
              System.out.println("------con is null--------");
          st = con.prepareStatement(sql);

          System.out.println("-----当前插入明细id:"+vo.getFid()+", 具体项目编号:"+vo.getFjtxmbh()+","+vo.getFjtxmmc());


          if (vo.getFid().equals("")) {
              vo.setFid(String.valueOf(IdManager.nextID(PubConstant.TINDEXDETAIL_ID)));
          }

          //为SQL赋参数值
          st.setLong(1,Long.parseLong(vo.getFid()));

          st.setString(2,vo.getFjtxmbh().trim());
          st.setString(3,vo.getFjtxmmc().trim());
          st.setString(4,vo.getFyear().trim());
          if (vo.getFdwid()!=null && !vo.getFdwid().equals(""))
              st.setLong(5,Long.parseLong(vo.getFdwid()));
          else
              st.setNull(5,Types.BIGINT);

          if (vo.getFyskmid()!=null && !vo.getFyskmid().equals(""))
              st.setLong(6,Long.parseLong(vo.getFyskmid()));
          else
              st.setNull(6,Types.BIGINT);

          if (vo.getFzcxmid()!=null && !vo.getFzcxmid().equals(""))
              st.setLong(7,Long.parseLong(vo.getFzcxmid()));
          else
              st.setNull(7,Types.BIGINT);

          if (vo.getFywksid()!=null && !vo.getFywksid().equals(""))
              st.setLong(8,Long.parseLong(vo.getFywksid()));
          else
              st.setNull(8,Types.BIGINT);


          if (vo.getFzjlybh()!=null && !vo.getFzjlybh().equals(""))
              st.setLong(9,Long.parseLong(vo.getFzjlybh()));
          else
              st.setNull(9,Types.BIGINT);

          if (vo.getFqzhjid()!=null && !vo.getFqzhjid().equals(""))
              st.setLong(10,Long.parseLong(vo.getFqzhjid()));
          else
              st.setNull(10,Types.BIGINT);
          st.setString(11,vo.getFyt().trim());
          st.setString(12,vo.getFwjyj().trim());
          st.setString(13,vo.getFwjlj().trim());

          if (vo.getFinmoney()!=null && !vo.getFinmoney().equals(""))
              st.setDouble(14,Double.parseDouble(vo.getFinmoney()));
          else
              st.setNull(14,Types.DOUBLE);
          if (vo.getFoutmoney()!=null && !vo.getFoutmoney().equals(""))
              st.setDouble(15,Double.parseDouble(vo.getFoutmoney()));
          else
              st.setNull(15,Types.DOUBLE);

          st.setString(16,vo.getFsfzfcg().trim());
          st.setString(17,vo.getFsfdap().trim());
          st.setString(18,vo.getFsfbmys().trim());

          if (vo.getFzblyid()!=null && !vo.getFzblyid().equals(""))
              st.setLong(19,Long.parseLong(vo.getFzblyid()));
          else
              st.setNull(19,Types.BIGINT);

          if (vo.getFzjxzid()!=null && !vo.getFzjxzid().equals(""))
              st.setLong(20,Long.parseLong(vo.getFzjxzid()));
          else
              st.setNull(20,Types.BIGINT);

          if (vo.getFjflxid()!=null && !vo.getFjflxid().equals(""))
              st.setLong(21,Long.parseLong(vo.getFjflxid()));
          else
              st.setNull(21,Types.BIGINT);

          if (vo.getFtjlxid()!=null && !vo.getFtjlxid().equals(""))
              st.setLong(22,Long.parseLong(vo.getFtjlxid()));
          else
              st.setNull(22,Types.BIGINT);

          st.setString(23,vo.getFyt().trim());
          st.setString(24,vo.getFtype().trim());
          st.setLong(25,Long.parseLong(vo.getFzid()));

          if (vo.getFgroupid()!=null && !vo.getFgroupid().equals(""))
              st.setLong(26,Long.parseLong(vo.getFgroupid()));
          else
              st.setNull(26,Types.BIGINT);

          st.setString(27,vo.getFdriect().trim());

          if (vo.getFoldindex()!=null && !vo.getFoldindex().equals(""))
              st.setLong(28,Long.parseLong(vo.getFoldindex()));
          else
             st.setNull(28,Types.BIGINT);

          st.setString(29,vo.getFdownstate().trim());
          st.setString(30,vo.getFtype().trim());

          if(st==null)
              System.out.println("- st null--:");
         
          ret= st.executeUpdate();
      }
      catch(SQLException e) {
          ret =-1;
          con.rollback();
          System.out.println("- 添加明细错误信息1--:"+e.getLocalizedMessage());
          System.out.println("- 错误码1--:"+e.getErrorCode()+"/"+e.getSQLState());
          e.printStackTrace(System.out);
      }
      catch(Exception e) {
          ret =-1;
          con.rollback();
        
          System.out.println("- 添加明细错误信息2--:"+e.getLocalizedMessage());
          e.printStackTrace(System.out);
         
          throw new DefaultException(e.getMessage(),DefaultException.ERROR);
      }
      finally {
          try {
              if (st!=null)
                  st.close();
          }
          catch(SQLException e) {
              e.printStackTrace(System.out);
          }

          //System.out.println("--------增加从表-----------:"+ret);
          return ret;
      }

  }




  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 打赏
    打赏
  • 扫一扫,分享海报

参与评论 您还未登录,请先 登录 后发表或查看评论
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页

打赏作者

denisfang

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值