Connection conn;
Statement stat;
String url="jdbc:mysql://localhost:3306/student";
String userName="root";
String password="123";
int stuID=Integer.parseInt(request.getParameter("stuID"));
String stuName=new String(request.getParameter("stuName").getBytes("iso-8859-1"),"gb2312");
String stuTelephone=new String(request.getParameter("Telephone").getBytes("iso-8859-1"),"gb2312");
try{
Class.forName("com.mysql.jdbc.Driver");
}catch(ClassNotFoundException ex){
out.println("找不到驱动程序");
}
conn=DriverManager.getConnection(url,userName,password);
try{
stat=conn.createStatement();
stat.executeUpdata("insert into student_Info value("+stuID+
",'"+stuName+"','"+stuTelephone+"')");
out.println("数据表操作成功!已经添加学生:");
}catch(SQLException ex){
out.println("数据表操做失败!");
}
finally{
conn.close();
}
红的地方报错:The method executeUpdata(String) is undefined for the type Statement是什么原因啊
Statement stat;
String url="jdbc:mysql://localhost:3306/student";
String userName="root";
String password="123";
int stuID=Integer.parseInt(request.getParameter("stuID"));
String stuName=new String(request.getParameter("stuName").getBytes("iso-8859-1"),"gb2312");
String stuTelephone=new String(request.getParameter("Telephone").getBytes("iso-8859-1"),"gb2312");
try{
Class.forName("com.mysql.jdbc.Driver");
}catch(ClassNotFoundException ex){
out.println("找不到驱动程序");
}
conn=DriverManager.getConnection(url,userName,password);
try{
stat=conn.createStatement();
stat.executeUpdata("insert into student_Info value("+stuID+
",'"+stuName+"','"+stuTelephone+"')");
out.println("数据表操作成功!已经添加学生:");
}catch(SQLException ex){
out.println("数据表操做失败!");
}
finally{
conn.close();
}
红的地方报错:The method executeUpdata(String) is undefined for the type Statement是什么原因啊
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)什么情况啊?
无法编译类
。