Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    16

    Unanswered: 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 doesn´t 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.

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322

    Re: NullPointerException in CallableStatement

    Sure it does...


    Code:
    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?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Oct 2003
    Posts
    16

    Re: NullPointerException in CallableStatement

    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...


    Code:
    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •