tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Sorokorensky <al...@millstar.com>
Subject RE: JDBC taglib and java.sql.SQLException: General error
Date Tue, 19 Jun 2001 18:36:59 GMT
Maybe it would help if you changed your query from:
  <sql:query>
    INSERT INTO mytable VALUES (?, ?, ?)
  </sql:query>
to:
  <sql:query>
    INSERT INTO mytable ([param1], [param2], [param3])
	 VALUES (?, ?, ?)
  </sql:query>

replacing [paramX] with the actual table column names.

-Alex

-----Original Message-----
From: Emir Alikadic (ADNOC IS&T) [mailto:ealikadic@adnoc.com]
Sent: Tuesday, June 19, 2001 3:29 AM
To: taglibs-user@jakarta.apache.org
Subject: JDBC taglib and java.sql.SQLException: General error


Hiya all!

I'm using JDBC taglib with MS SQL Server 6.5 and JDBC:ODBC bridge for our
evaluation of J2EE.  I'm able to retrieve data with no problem, but while
attempting to insert data using preparedStatement, I constantly get the
following error:

-----
Error: 500
Location: /test/storedata.jsp
Internal Servlet Error:
javax.servlet.ServletException: java.sql.SQLException: General error
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:459)
at
_0002fstoredata_0002ejspstoredata_jsp_0._jspService(_0002fstoredata_0002ejsp
storedata_jsp_0.java:1192)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:166)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
Root cause:
javax.servlet.jsp.JspTagException: java.sql.SQLException: General error
at
org.apache.taglibs.jdbc.statement.ExecuteTag.doEndTag(ExecuteTag.java:111)
at
_0002fstoredata_0002ejspstoredata_jsp_0._jspService(_0002fstoredata_0002ejsp
storedata_jsp_0.java:1132)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:166)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
-----

My web.xml contains necessary initParameters for DB connection details.

The storedata.jsp is invoked by a form in dbentry.jsp.  Here's complete code
to storedata.jsp (actual table/parameter names changed for obvious reasons):


<%@ page contentType="text/html; charset=iso-8859-1" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/jdbc" prefix="sql" %>

<!DOCTYPE html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<%@ include file="header.inc" %>
<BODY>

<sql:connection id="conn0">
  <sql:url initParameter="dbURL"/>
  <sql:driver initParameter="dbDriver"/>
  <sql:userId initParameter="dbUser"/>
  <sql:password initParameter="dbPasswd"/>
</sql:connection>

<sql:preparedStatement id="pstmt0" conn="conn0">
  <sql:query>
    INSERT INTO mytable VALUES (?, ?, ?)
  </sql:query>
  <sql:execute>
    <sql:setColumn position="1"><%= request.getParameter("param1")
%></sql:setColumn>
    <sql:setColumn position="2"><%= request.getParameter("param2")
%></sql:setColumn>
    <sql:setColumn position="3"><%= request.getParameter("param3")
%></sql:setColumn>
  </sql:execute>
</sql:preparedStatement>

<sql:closeConnection conn="conn0"/>

<P>Client info succefully stored!</P>
<%@ include file="copyright.inc" %>
</BODY>
</HTML>


I'd appreciate any help on this.

Regards,



Emir Alikadic

Mime
View raw message