Monday, April 21, 2008

java.lang.NullPointerException when accessing ResultSet from SQL Server

I used Java JDBC to call a SQL Server Stored Procedure and got a NullPointerException from the last line of the following innocent code below:
stmt.execute();
rs = stmt.getResultSet();
while (rs.next()) ...

The stored procedure looks like:
operation 1
operation 2
select ... from ...

It turns out that 'SET NOCOUNT ON' should be added into the stored procedure before the 'operation 1'.

No comments:

Post a Comment