You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Erez Nahir <en...@cisco.com> on 2003/12/18 22:16:03 UTC

[DBUtil] setNull cause insert to fail.

Hi,
 
I have a code with sql having long, int, String and boolean values. Some of
my Strings can be null. 
When QueryRunner.fillStatement identify null value in the object[] it uses
stmt.setNull(Types.OTHER); after the sql is filled with the params, the
executeUpdate fails with excetion message:
 
Failed to insert base data JZ006: Caught IOException: java.io.IOException:
JZ0SM: Unsupported SQL type 1111. Query: insert into BB_MAIN
(OBJECTID,ACTOBJECTID,NODEID,ACTIVITYID,CHANGE,TYPE,NAME,"COMMENT",CATEGORY,
MANDATORY,"GROUP",REFS)values (?,?,?,?,?,?,?,?,?,?,?,?) Parameters: [0, 0,
0, 0, null, Network, NetName, Comment, red, false, true, null]
 
I'm using Sybase 8.0.2. 
 
Is this a known problem?, is there a solution?
Before I switched to DBUtil it worked fine with stmt.setString(null), but I
had to write lot of code:-(.
 
Thanks,
Erez.

Re: [DBUtil] setNull cause insert to fail.

Posted by David Graham <gr...@yahoo.com>.
--- Erez Nahir <en...@cisco.com> wrote:
> Hi,
>  
> I have a code with sql having long, int, String and boolean values. Some
> of
> my Strings can be null. 
> When QueryRunner.fillStatement identify null value in the object[] it
> uses
> stmt.setNull(Types.OTHER); after the sql is filled with the params, the
> executeUpdate fails with excetion message:
>  
> Failed to insert base data JZ006: Caught IOException:
> java.io.IOException:
> JZ0SM: Unsupported SQL type 1111. Query: insert into BB_MAIN
>
(OBJECTID,ACTOBJECTID,NODEID,ACTIVITYID,CHANGE,TYPE,NAME,"COMMENT",CATEGORY,
> MANDATORY,"GROUP",REFS)values (?,?,?,?,?,?,?,?,?,?,?,?) Parameters: [0,
> 0,
> 0, 0, null, Network, NetName, Comment, red, false, true, null]
>  
> I'm using Sybase 8.0.2. 
>  
> Is this a known problem?, is there a solution?

Maybe this is a problem with the Sybase driver you're using.  You can
subclass QueryRunner and override the fillStatement method to do what you
need.

David

> Before I switched to DBUtil it worked fine with stmt.setString(null),
> but I
> had to write lot of code:-(.
>  
> Thanks,
> Erez.
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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