You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Marc Esher (4-2060)" <me...@argusgroupinc.com> on 2005/01/26 18:57:21 UTC

[dbutils] Inserting Null values with QueryRunner.update()

Greetings.

 

I'm running a query that inserts a null value into a SQL Server 2000
field that accepts null values. Here's the error I get:

 

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]The
specified SQL type is not supported by this driver. Query: UPDATE
Requests SET SystemID=?, ProcessTypeID=?, RushRequest=?,
RequestPowerRating=?, StatusID=?, LastQueuedTS=?, ServerGroupID=? WHERE
RequestID=? Parameters: [1, 1, 0, 30, 4, null, 3, 1]

      at
org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:330)

      at
org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:399)

 

I don't know if this is a problem with dbutils itself, with how I'm
using dbutils, or with sql server 2000.

 

Any advice?

 

Thanks.


Re: [dbutils] Inserting Null values with QueryRunner.update()

Posted by David Graham <gr...@yahoo.com>.
In DbUtils 1.0 QueryRunner.fillStatement() used Types.OTHER when setting a
null value.  This bug documents the change to using Types.VARCHAR instead:
http://issues.apache.org/bugzilla/show_bug.cgi?id=29212

All of the tested drivers listed in the ticket work with VARCHAR. 
Download a DbUtils nightly build and let us know if it still doesn't work
with VARCHAR.  You can override fillStatement() to use the type that works
for SQL Server.

David


--- "Marc Esher (4-2060)" <me...@argusgroupinc.com> wrote:

> Greetings.
> 
>  
> 
> I'm running a query that inserts a null value into a SQL Server 2000
> field that accepts null values. Here's the error I get:
> 
>  
> 
> java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]The
> specified SQL type is not supported by this driver. Query: UPDATE
> Requests SET SystemID=?, ProcessTypeID=?, RushRequest=?,
> RequestPowerRating=?, StatusID=?, LastQueuedTS=?, ServerGroupID=? WHERE
> RequestID=? Parameters: [1, 1, 0, 30, 4, null, 3, 1]
> 
>       at
> org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:330)
> 
>       at
> org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:399)
> 
>  
> 
> I don't know if this is a problem with dbutils itself, with how I'm
> using dbutils, or with sql server 2000.
> 
>  
> 
> Any advice?
> 
>  
> 
> Thanks.
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250

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