On a slightly different topic, how about trying a different driver: http://jtds.sourceforge.net/
Quoting Derek Mahar <[EMAIL PROTECTED]>: > I need to clarify the first statement that I made in my previous post (see > below). I claim that parameter sqlType in method > PreparedStatement.setNull(int parameterIndex, int sqlType) is redundant > because a NULL SQL parameter has no intrinsic type. A NULL SQL value applies > to any column type, so it is unnecessary to identify its type. > > Derek > > -----Original Message----- > From: Derek Mahar > Sent: May 20, 2004 2:08 PM > To: Tag Libraries Users List > Subject: RE: [JSTL] How do I enter a null value with <sql:param>? > > > Thank you. I appreciate your attention and quick response. > > After reading JDBC Specification Section 13.2.2.3, Setting NULL Parameters, I > understand now why Kris suggested that the JSTL specification add the sqlType > attribute to <sql:param>: method PreparedStatement.setNull(int > parameterIndex, int sqlType) requires the type of the parameter that you want > to set to NULL. However, why does method setNull require this parameter? A > NULL parameter has no intrinsic type! In order to determine the "type" of a > NULL parameter, you must consider its expression or assignment context. That > is, in order to determine the "type" of a NULL parameter, must consider the > type of the column to which you are assigning the parameter in a SET clause > or the column or literal value to which you are comparing the parameter in a > WHERE clause. Or, you must assign it a type using a new attribute like > sqlType. > > According to JDBC Specification Section 13.2.3, Describing Outputs and Inputs > of a PreparedStatement Object, ParameterMetaData.getParameterMetaData(int > param) returns the type of each parameter in a parameterized query. What > "type" does this method return for a NULL parameter? If it does, in fact, > return a NULL parameter's contextual type, then I can change the <sql:param> > implementation so that it invokes PreparedStatement.setNull instead of > PreparedStatement.setObject for NULL parameters. Otherwise, I cannot see how > I can supply setNull with a correct "type". Consequently, I'll just have to > wait for Microsoft to fix its JDBC driver so that it correctly handles the > case PreparedStatement.setObject(index,null). > > Derek > > -----Original Message----- > From: Justyna Horwat [mailto:[EMAIL PROTECTED] > Sent: May 20, 2004 1:10 PM > To: Tag Libraries Users List > Subject: Re: [JSTL] How do I enter a null value with <sql:param>? > > > Derek, > > I forwarded your comments to the JDBC specification lead. He said that > now is a good time to bring up all of these annoyances in the > specification. He will look into clarifying this area in the upcoming > version of the spec. > > Thanks, > > Justyna > > Derek Mahar wrote: > > > After reading Section 17.7 of the JDBC specification (available at > > http://java.sun.com/products/jdbc/download.html), I now agree that > > there is a problem with the Microsoft SQL JDBC driver, but there is > > also a problem with the official Java JDBC API documentation that does > > not mention how PreparedStatement.setObject() handles the case > > PreparedStatement.setObject(index, null). I guess we should ask Sun > > to correct (or complete) its JDBC API documentation and I need to ask > > Microsoft to fix its JDBC driver. > > > > However, I still need to fix my problem now. So, as I have Standard > > Tag Library source code, but do not have the source of the Microsoft > > SQL Server JDBC driver, I will likely change the <sql:param> > > implementation so that it invokes PreparedStatement.setNull() when it > > receives a null value. Here is a perfect case where having source > > code is of tremendous benefit. > > > > Thank you for pointing me in the right direction and being patient > > with my posts as I worked through my problem. > > > > Derek > > > > -----Original Message----- > > From: Wolfgang Röckelein > > [mailto:[EMAIL PROTECTED] > > 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: > >>http://www.mail-archive.com/[EMAIL PROTECTED]/msg06748.h > >>tml > > > > > > 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... > > > > Regards, > > Wolfgang -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]