Friday, March 9, 2012

NullPointerException in CallableStatement

Hi,

First of all sorry for my pour english.

My development work is SqlServer 2000 + Web Server + JDBC
I have in my db a simple store procedure which inserts in a table rows.
My problem is when I try to insert over 1030 rows more or less. In my program the JDBC returns to me a NullPointerException in the Connection object, but when i try to insert for example 100 rows everything is ok.

I have try it with some web servers like JRun, Tomcat, etc.. and with differents jdbc too and its the same, so I think that the problem is in my database.

This Store Procedure doesnt work:
------------
declare @.i int
set @.i = 0
while @.i<10000
begin
insert into mig values (getdate(), 'p', @.i)
set @.i = @.i + 1
end
--------

And this Store Procedure works:
--------
declare @.i int
set @.i = 0
while @.i<1000 (<1030 +o-)
begin
insert into mig select getdate(), 'p', 1 from sanresco where reciae between 1 and 100000
set @.i = @.i + 1
end
----------

So the problem is when the db tries to do over 1023 individual inserts.

Any idea??

Thanks.Sure it does...

USE Northwind
GO

CREATE TABLE mig (col1 datetime, col2 char(1), col3 int)
GO

CREATE PROC mySPROC AS

SET NOCOUNT ON
DECLARE @.i int
SET @.i = 0
WHILE @.i < 10000
BEGIN
INSERT INTO mig (col1, col2, col3)
VALUES (getdate(), 'p', @.i)
SET @.i = @.i + 1
END
SET NOCOUNT OFF
GO

EXEC mySPROC
GO

SELECT COUNT(*) FROM mig
GO

DROP TABLE mig
GO

DROP PROC mySPROC
GO

Why not post the DDL of the table...any triggers? Are you timing out on the front end?|||Thanks a lot!!!!!!!
I put "set nocount on" in the sp and it works!!!!!
I had very long time ago with this problem.
Greetings.

Originally posted by Brett Kaiser
Sure it does...

USE Northwind
GO

CREATE TABLE mig (col1 datetime, col2 char(1), col3 int)
GO

CREATE PROC mySPROC AS

SET NOCOUNT ON
DECLARE @.i int
SET @.i = 0
WHILE @.i < 10000
BEGIN
INSERT INTO mig (col1, col2, col3)
VALUES (getdate(), 'p', @.i)
SET @.i = @.i + 1
END
SET NOCOUNT OFF
GO

EXEC mySPROC
GO

SELECT COUNT(*) FROM mig
GO

DROP TABLE mig
GO

DROP PROC mySPROC
GO

Why not post the DDL of the table...any triggers? Are you timing out on the front end?

No comments:

Post a Comment