String new_score = "update learning_paper set lp_votetimes = '"+ newscore + "' where lp_issue='"+issue+"' and lp_part='"+part+"' and lp_title='"+title+"'";
open();
try {
st = dbConn.createStatement();
//PreparedStatement ps = dbConn.prepareStatement(new_score);
//ps.executeUpdate();
st.execute(new_score);
//st.executeUpdate(new_score);
} catch (SQLException e) {
close();
}
new_score 语句在数据库中可以执行,但是写成java语句就没有反应,不报错,估计是tomcat没反应了。各位高手帮我看看,是什么问题?

解决方案 »

  1.   

    new_score 语句在数据库中可以执行,那是你把数据写死了。你试试在DEBUG下 测试 new_score 是如何生成 SQL 的。
      

  2.   

    重启数据库服务,重启TOMCAT试试,可能是类似缓存的问题
      

  3.   

    把你的new_score输出到控制的台,然后再复制出来放到数据库中去执行看,能不能出结果。
      

  4.   

    你的代码有在sevlet里面掉用吗?既然你用到了tomcat,你肯定是jsp页面提交过来然后条用这些方法的吧String new_score = "update learning_paper set lp_votetimes = '"+ newscore + "' where lp_issue='"+issue+"' and lp_part='"+part+"' and lp_title='"+title+"'"; 
    open(); 
    try { 
    st = dbConn.createStatement(); 
    //PreparedStatement ps = dbConn.prepareStatement(new_score); 
    //ps.executeUpdate(); 
    st.execute(new_score); 
    //st.executeUpdate(new_score); 
    } catch (SQLException e) { 
    close(); 
    } 1 首先看看你的jsp页面提交到servlet是否成功!,在你的servlet的 post()方法里System.out.print("进入Servlet");2 看看有没有反应!。如果你的jsp进入了servlet,你的方法说明也成功了,然后检查你的参数从jsp传递过来没有!
       例如:System.out.print(request.getParamete("newscore"))3 在servlet中system.out.print(new_score);检查你的动态生成的sql语句是否语法有误3 st对象中的executeUpdate();方法返回int的 你可以 System.out.print(st.executeUpdate(new_score)); 检查的修改有没有成功
      

  5.   

    郁闷啊,我用的就是debug模式啊,new_score语句copy出来,在pl/sql中可以执行的,猫也重启过,数据库没问题。dbConn.commit();也做了。
    就是不报错,也不出异常就是 突然不执行了...
      

  6.   

    按你的方法做了,可惜还是没测出来。具体情况就是在st.execute(new_score); 或者st.executeUpdate(new_score); 之前的代码都执行,而且是正确的。而之后的代码都不执行,也就是卡在这句代码上了,而且还不抛异常,也不报错,好诡异啊。好像在等待什么东西...
      

  7.   

    system.out.print(st.executeUpdate(new_score));在控制台显示了什么信息没有
      

  8.   

    system.out.print(st.executeUpdate(new_score));在控制台显示了什么信息没有在控制台什么都没有,就是执行到这里就没有了,而前面的System.out都在执行,断电都清掉了啊....呜呜,我改成select语句,用excute和executeQuery都可以。
      

  9.   

    从描述上看,可能是learning_paper这张表上存在锁。
      

  10.   

    String new_score = "update learning_paper set lp_votetimes = '"+ newscore + "' where lp_issue='"+issue+"' and lp_part='"+part+"' and lp_title='"+title+"'"; 
    open(); 
    try { 
    st = dbConn.createStatement(); 
    //PreparedStatement ps = dbConn.prepareStatement(new_score); 
    //ps.executeUpdate(); 
    st.execute(new_score); 
    //st.executeUpdate(new_score); 
    } catch (SQLException e)

      //你这里没有处理异常 你只是捕捉了 system.out.print(e.getMessage()+"aaaaaaaaaaaaa");
    close(); 
    } 你这样试试
      

  11.   

    谢谢大家帮忙了,问题基本确认了,是那个垃圾软件pl/sql的问题,它连接以后,我就操作不了,关了就好了。我真想骂人了,还有这样的软件,呜呜....
      

  12.   

    太感谢了,我也是找了好久没找到问题,多谢你的提醒.PL/SQL加了写锁了