Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug? setNull(index, Types.BLOB) causes NullPointerException

3 views
Skip to first unread message

Joe

unread,
May 6, 2004, 11:06:59 AM5/6/04
to
I am using the Version 2.2.0037 of the MS JDBC drivers,
connecting to my SQL Server 2000 service pack 3 database.
I have a table used to store binary files. When my image
column is null, I use PreparedStatement.setNull(index,
Types.Blob ). This causes the following error:

java.lang.NullPointerException
at
com.microsoft.jdbc.sqlserver.tds.TDSRPCParameter.initialize
UserParam(Unknown Source)
at
com.microsoft.jdbc.sqlserver.SQLServerImplStatement.addUser
ParametersToRPC(Unknown Source)
at
com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute
(Unknown Source)
at
com.microsoft.jdbc.base.BaseStatement.commonExecute
(Unknown Source)
at
com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal
(Unknown Source)
at
com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate
(Unknown Source)


As a work around hack the following code seems to work:

pStmt.setBinaryStream(index,null, 0);

Unknown

unread,
May 25, 2004, 2:47:20 AM5/25/04
to
To set the blob as null in database, use stmt.setBinaryStream(index,null, 0); In stead of stmt.setNull(index, Types.BLOB);

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...

0 new messages