我用dbutils中的QueryRunner方法项数据库中添加数据,为什么报500错误 10
try{Contextcontext=newInitialContext();DataSourceds=(DataSource)context.lookup("java:...
try {
Context context = new InitialContext();
DataSource ds = (DataSource) context.lookup("java:/comp/env/jdbc/oracleds");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
QueryRunner qr = new QueryRunner(ds);
String param[] = { StringUtil.FilterHtml(name),
StringUtil.FilterHtml(request.getParameter("phone")),
StringUtil.FilterHtml(request.getParameter("email")),
StringUtil.FilterHtml(title),
request.getParameter("content"),
sdf.format(new java.util.Date()) };
result = qr.update(sql, param);
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.AbstractMethodError: oracle.jdbc.driver.T4CPreparedStatement.getParameterMetaData()Ljava/sql/ParameterMetaData;
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:223)
org.apache.commons.dbutils.QueryRunner.fillStatement(QueryRunner.java:176)
org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:595)
org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:655)
com.v512.AddMessage2Servlet.doPost(AddMessage2Servlet.java:96)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs. 展开
Context context = new InitialContext();
DataSource ds = (DataSource) context.lookup("java:/comp/env/jdbc/oracleds");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
QueryRunner qr = new QueryRunner(ds);
String param[] = { StringUtil.FilterHtml(name),
StringUtil.FilterHtml(request.getParameter("phone")),
StringUtil.FilterHtml(request.getParameter("email")),
StringUtil.FilterHtml(title),
request.getParameter("content"),
sdf.format(new java.util.Date()) };
result = qr.update(sql, param);
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.AbstractMethodError: oracle.jdbc.driver.T4CPreparedStatement.getParameterMetaData()Ljava/sql/ParameterMetaData;
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:223)
org.apache.commons.dbutils.QueryRunner.fillStatement(QueryRunner.java:176)
org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:595)
org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:655)
com.v512.AddMessage2Servlet.doPost(AddMessage2Servlet.java:96)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs. 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询