Keith wrote:
Ahhh, ok. I assumed it was the JSTL stuff throwing the error. I've not done much programming in actual Java, which is why I'm using the JSTL library.

The field is set to accept a NULL value in the database. There's already data in the database, and there's many DOB's missing for some people. I can do inserts to the database from SQL*Plus fine and leave the date fields blank. It's just when I'm trying to do it via JSP. I'm trying to design an new interface to the database and this has been my roadblock for the week.

Okay. Which JDBC driver are you using? If it's the JDBC-ODBC bridge, I suggest you try with a real Oracle JDBC type 3 or 4 driver instead. The bridge driver is buggy and not intended for production use.

Hans

---------- Original Message -----------
From: Hans Bergsten <[EMAIL PROTECTED]>
To: Tag Libraries Users List <[EMAIL PROTECTED]>
Sent: Tue, 30 Mar 2004 19:30:44 -0800
Subject: Re: More SQL Date problems


Keith wrote:

Now I'm thorougly confused. I could've sworn this was working before (as I claimed

in my


first email to the group.


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


<sql:transaction>

<sql:update>
INSERT INTO resource_registry ( dob ) VALUES (? <sql:dateParam value="${parsed_dob}" type="date"/> )
</sql:update>


</sql:transaction>


This works perfectly fine when I put a date in the format specified in the parseDate action. The JSP book I got (O'Reilly 3rd Ed) says the <sql:dateParam> action is

supposed


to set the value to an SQL NULL when a null value is provided to it. I keep getting

an


Invalid Column Type SQL exception (not an Oracle error) back whenever I leave the

date


field blank. Anyone know what's wrong? Thanks!

It looks to me as if the "Invalid Column Type SQL exception" indeed comes from the database (or the JDBC driver), because nothing in JSTL can issue such an error message (JSTL doesn't have enough info; it just relays the error issued by the JDBC driver).

JSTL sets the parameter in the SQL statement to SQL NULL if the
<sql:dateParam> value is null (according to the spec; bugs in an
implementation is a different story). One possible reason for the
error you get is that the column isn't declared to accept a NULL
value. Check the database table constraints.

Hans

-- Hans Bergsten <[EMAIL PROTECTED]> Gefion Software <http://www.gefionsoftware.com/> Author of O'Reilly's "JavaServer Pages", covering JSP 2.0 and JSTL 1.1 Details at <http://TheJSPBook.com/>


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to