javax.naming.NameNotFoundException: Name TestDB is not bound in this ContextIntentCompanyBean的insert方法运行异常:null不知道咋回事了

解决方案 »

  1.   

    总之就是在调用这个函数的时候出现了异常
    public boolean Insert() {
        boolean b = false;
        try {
          con = connBean.getConnection();
          pstmt = con.prepareStatement(this.getStrSql());
          pstmt.setString(1, this.getCompanyName());
          pstmt.setString(2, this.getContactPhone());
          pstmt.setString(3, this.getContactPerson());
          pstmt.setString(4, this.getContactPhone_K());
          pstmt.setString(5, this.getContactPerson_K());
          pstmt.setString(6, this.getAddress());
          pstmt.setString(7, this.getTalkMode());
          pstmt.setString(8, this.getTalkDate());
          pstmt.setInt(9, this.getEmployeeID());
          pstmt.setString(10, this.getRe());
          pstmt.executeUpdate();
          b = true;
        }
        catch (Exception ex) {
          System.out.println("   IntentCompanyBean的insert方法运行异常:"+ex.getMessage());
        }
        finally {
          freeMem();
        }
        return b;
      }
      

  2.   

    int i = pstmt.executeUpdate();
    if(i==1){
    b = true;
    }      
    看了下也只有这里和
      con = connBean.getConnection();
    System.out.println(con);
    con.prepareStatement(this.getStrSql());
    System.out.println(this.getStrSql()));
    才会有空指针了,看哪个输出NULL