tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Mahar" <>
Subject RE: [JSTL] How do I enter a null value with <sql:param>?
Date Wed, 19 May 2004 16:11:34 GMT
I don't agree.  PreparedStatement has two methods that <sql:param> can use to properly
set a NULL value:

PreparedStatement.setObject(int parameterIndex, Object x, int targetSqlType)
PreparedStatement.setNull(int parameterIndex, int sqlType)

In both cases, you must determine the type of the value, be it java.sql.Types.INTEGER, java.sql.Types.VARCHAR,
or java.sql.Types.NULL.  The sqlType in setNull strikes me as redundant, but for some reason,
perhaps the JDBC driver requires a type even when setting its value to NULL.


-----Original Message-----
From: Wolfgang Röckelein [] 
Sent: May 19, 2004 10:40 AM
To: Tag Libraries Users List
Subject: Re: [JSTL] How do I enter a null value with <sql:param>?

Keith wrote:
> This was on the Users list and was my problem. But mine had to do 
> specifically with the
> <sql:dateParam> and the Oracle JDBC driver. The regular <sql:param> worked
fine for me 
> when I passed it a null value. 
> Link to the starting thread in the archive:

Thanks for digging this out. Both problems boil down to the case that "when setObject(index,
null) is passed in a null value this should be converted 
by the driver to an SQL null" does not work with the JDBC driver (perhaps only 
for certain data types, which could be the cause why you see it only with 
<sql:dateParam>). From my experience I know that the MS SQL JDBC driver has/had 
problems in this area...


To unsubscribe, e-mail:
For additional commands, e-mail:

NOTICE: This email contains privileged and confidential information and is intended only for
the individual to whom it is addressed. If you are not the named addressee, you should not
disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail
if you have received this transmission by mistake and delete this communication from your
system. E-mail transmission cannot be guaranteed to be secured or error-free as information
could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.

AVIS: Le présent courriel contient des renseignements de nature privilégiée et confidentielle
et n’est destiné qu'à la personne à qui il est adressé. Si vous n’êtes pas le destinataire
prévu, vous êtes par les présentes avisés que toute diffusion, distribution ou reproduction
de cette communication est strictement interdite.  Si vous avez reçu ce courriel par erreur,
veuillez en aviser immédiatement l’expéditeur et le supprimer de votre système. Notez
que la transmission de courriel ne peut en aucun cas être considéré comme inviolable ou
exempt d’erreur puisque les informations qu’il contient pourraient être interceptés, corrompues,
perdues, détruites, arrivées en retard ou incomplètes ou contenir un virus.  

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message