You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Alfredo Ledezma Melendez <al...@mail.telcel.com> on 2005/06/08 00:31:34 UTC
[DbUtils] Handling null values during an update
Hello,
I've been using dbutils with mysql, postgresql, even with SQL Server
successfully for quite a long time. But now I'm facing a little problem with
Oracle9i (thin-driver and jdbc-odbc). I have a table with two fields of type
DATE; when I try to UPDATE a row using methos update from QueryRunner in this
table using null values, it throws the exception:
java.sql.SQLException: Invalid column type Query: UPDATE factura SET
fechaFacturacion = ?, fechaPedido = ? WHERE folioECAC = ? Parameters: [null,
null, 278]
However, using not null values it runs perfect. I've been looking in some forums
and they say the problem is that driver does not how to set null values for
those values of the table. Is there any workaround, somebody has solved this
problem before, should I use PreparedStatement instead of QueryRunner?
Any help would be really appreciated.
Best regards,
____________________________________________
Alfredo Ledezma Mel�ndez.
Gerencia de Sistemas CRM
Consultor Externo de Sistemas de Atenci�n a Clientes
RadioMovil DIPSA, S. A. de C. V.
Ej�rcito Nacional No. 488, Col. Anahuac, C.P. 11570
M�xico D.F.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [DbUtils] Handling null values during an update
Posted by David Graham <gr...@yahoo.com>.
In the latest nightly builds, QueryRunner.fillStatement() uses
Types.VARCHAR to set columns to NULL:
http://jakarta.apache.org/commons/dbutils/xref/org/apache/commons/dbutils/QueryRunner.html#118
If you are using DbUtils 1.0, try a nightly build. If you're already
using the latest code and it still fails, subclass QueryRunner and
override fillStatement() with the appropriate behavior.
David
--- Alfredo Ledezma Melendez <al...@mail.telcel.com> wrote:
> Hello,
>
> I've been using dbutils with mysql, postgresql, even with SQL Server
> successfully for quite a long time. But now I'm facing a little problem
> with
> Oracle9i (thin-driver and jdbc-odbc). I have a table with two fields of
> type
> DATE; when I try to UPDATE a row using methos update from QueryRunner in
> this
> table using null values, it throws the exception:
> java.sql.SQLException: Invalid column type Query: UPDATE factura SET
> fechaFacturacion = ?, fechaPedido = ? WHERE folioECAC = ? Parameters:
> [null,
> null, 278]
> However, using not null values it runs perfect. I've been looking in
> some forums
> and they say the problem is that driver does not how to set null values
> for
> those values of the table. Is there any workaround, somebody has solved
> this
> problem before, should I use PreparedStatement instead of QueryRunner?
>
> Any help would be really appreciated.
>
> Best regards,
> ____________________________________________
> Alfredo Ledezma Meléndez.
> Gerencia de Sistemas CRM
> Consultor Externo de Sistemas de Atención a Clientes
> RadioMovil DIPSA, S. A. de C. V.
> Ejército Nacional No. 488, Col. Anahuac, C.P. 11570
> México D.F.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
Get Firefox!
http://www.mozilla.org/firefox/
__________________________________
Discover Yahoo!
Stay in touch with email, IM, photo sharing and more. Check it out!
http://discover.yahoo.com/stayintouch.html
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org