You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Keith <pd...@pdragon.net> on 2004/03/29 22:16:15 UTC

SQL Update problem with Dates

I'm creating a web form application with JSP to interact with an Oracle database. I'm 
using Tomcat 5.0.19, JSTL 1.1 Standard, and Oracle 9i Release 2. I'm running across a 
problem when I try to update a Date column in the database.  The date is entered via a 
text input field that I validate the format of via JavaScript. INSERTing the date as a 
NULL works fine (separate form from the update). It's when the Date column already has a 
value and I try to UPDATE it to a NULL value. The fmt:parseDate action was copied 
directly from my INSERT page, so I know that part works fine. I've verified that all 
other fields besides the Date fields are being passed and updated correctly. 
Thanks in advance!

Here are the relevant snippets of my code and the resultant error stack trace:

<fmt:parseDate value="${param.project_date}" var="parsed_project_date" pattern="dd-MM-
yyyy" />

<sql:transaction>

<sql:update>
	UPDATE ccevs_projects_registry SET 
		project_date = ? <sql:dateParam value="${parsed_project_date}" />	
				
	WHERE project_id = ? <sql:param value="${param.project_id}" />
</sql:update>

</sql:transaction>





exception 

javax.servlet.ServletException: 
	UPDATE ccevs_projects_registry SET 
		product_name = ? ,	
		project_date = ? 	
				
	WHERE project_id = ? 
: Invalid column type
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException
(PageContextImpl.java:864)
	org.apache.jasper.runtime.PageContextImpl.handlePageException
(PageContextImpl.java:800)
	org.apache.jsp.project_005fupdate_005fstore_jsp._jspService
(project_005fupdate_005fstore_jsp.java:141)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause 

java.sql.SQLException: Invalid column type
	oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
	oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
	oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
	oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:6414)
	oracle.jdbc.driver.OraclePreparedStatement.setNull
(OraclePreparedStatement.java:1354)
	oracle.jdbc.driver.OraclePreparedStatement.setObject
(OraclePreparedStatement.java:2791)
	oracle.jdbc.driver.OraclePreparedStatement.setObject
(OraclePreparedStatement.java:3217)
	org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.setParameters(Unknown 
Source)
	org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.doEndTag(Unknown 
Source)
	org.apache.jsp.project_005fupdate_005fstore_jsp._jspx_meth_sql_update_0
(project_005fupdate_005fstore_jsp.java:487)
	org.apache.jsp.project_005fupdate_005fstore_jsp._jspx_meth_sql_transaction_0
(project_005fupdate_005fstore_jsp.java:417)
	org.apache.jsp.project_005fupdate_005fstore_jsp._jspService
(project_005fupdate_005fstore_jsp.java:132)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org