当前位置: 技术问答>java相关
BEAN操作数据库错误。
来源: 互联网 发布时间:2017-04-25
本文导语: 我的BEAN: ...... .... public boolean executeUpdate(String sql){ boolean bupdate=false; try{ conn=DriverManager.getConnection(url); Statement stmt=conn.createStatement(); int rowCount=stmt.executeUpdate(sql); if (rowCount!=0) { bupdate=true; } } ...
我的BEAN:
......
....
public boolean executeUpdate(String sql){
boolean bupdate=false;
try{
conn=DriverManager.getConnection(url);
Statement stmt=conn.createStatement();
int rowCount=stmt.executeUpdate(sql);
if (rowCount!=0)
{
bupdate=true;
}
}
catch(SQLException e){
System.err.println(e.getMessage());
}
return bupdate;
}
.....
.....
jsp页面:
............
............
String sql="insert into news (subject,memo) values ('555','555')";
boolean bupdate=rrrsql.executeUpdate(sql);
if(bupdate){
response.sendRedirect("newsuser2.jsp");
}
else{
out.println("数据库操作出错!");
}
..........
..........
错误是:
exception
javax.servlet.ServletException: rrr.rrrsql.executeUpdate(Ljava/lang/String;)Z
...........................................
...........................................
root cause
java.lang.NoSuchMethodError: rrr.rrrsql.executeUpdate(Ljava/lang/String;)Z
...........................................
..........................................
请高手帮忙
......
....
public boolean executeUpdate(String sql){
boolean bupdate=false;
try{
conn=DriverManager.getConnection(url);
Statement stmt=conn.createStatement();
int rowCount=stmt.executeUpdate(sql);
if (rowCount!=0)
{
bupdate=true;
}
}
catch(SQLException e){
System.err.println(e.getMessage());
}
return bupdate;
}
.....
.....
jsp页面:
............
............
String sql="insert into news (subject,memo) values ('555','555')";
boolean bupdate=rrrsql.executeUpdate(sql);
if(bupdate){
response.sendRedirect("newsuser2.jsp");
}
else{
out.println("数据库操作出错!");
}
..........
..........
错误是:
exception
javax.servlet.ServletException: rrr.rrrsql.executeUpdate(Ljava/lang/String;)Z
...........................................
...........................................
root cause
java.lang.NoSuchMethodError: rrr.rrrsql.executeUpdate(Ljava/lang/String;)Z
...........................................
..........................................
请高手帮忙
|
系统找不到方法rrrsql.executeUpdate(string),把class文件删除,重新编译,重起服务器