编写jsp文件连接数据库删除表信息时报错

qq_33894726 2017-11-20 10:07:39
2017-11-20 22:04:07 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\MyEclipse10\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\bin;D:\MyEclipse10\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806\tomcat\bin
2017-11-20 22:04:07 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2017-11-20 22:04:07 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 282 ms
2017-11-20 22:04:07 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2017-11-20 22:04:07 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.13
2017-11-20 22:04:08 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2017-11-20 22:04:08 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2017-11-20 22:04:08 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/12 config=null
2017-11-20 22:04:08 org.apache.catalina.startup.Catalina start
信息: Server startup in 639 ms

李梅
2017-11-20 22:05:57 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column '?????…' in 'where clause'
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3250)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1355)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1270)
at org.apache.jsp.inputDelect_jsp._jspService(inputDelect_jsp.java:100)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
文件代码
<%@ page contentType="text/html" pageEncoding="utf-8"%>
<%@page import="java.sql.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'inputCheck.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>
<center>
<hr>
<%String name1=request.getParameter("name");
byte b[]=name1.getBytes("ISO-8859-1");
name1=new String(b,"utf-8");

Connection con=null;
Statement stmt=null;
ResultSet rs =null;
Class.forName("com.mysql.jdbc.Driver");
String url="jdbc:mysql://localhost:3306/chatroom?useUnicode=true&characterEncoding=gbk";
con = DriverManager.getConnection(url, "root","root");
stmt =con.createStatement();
System.out.println(name1);
String sql="delete from info where name = "+name1;
stmt.executeUpdate(sql);
stmt.close();
con.close();
%>
<center>

<a href="Contact.jsp">添加成功,点击返回</a>
</center>

</center>
</body>
</html>
...全文
186 2 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
墨笙弘一 2017-11-21
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column '?????…' in 'where clause
  • 打赏
  • 举报
回复
qq_33894726 2017-11-20
找到问题了,sql写错了。。。。。
  • 打赏
  • 举报
回复
相关推荐
发帖
Web 开发

8.0w+

社区成员

Java Web 开发
社区管理员
  • Web 开发社区
加入社区
帖子事件
创建了帖子
2017-11-20 10:07
社区公告
暂无公告