pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kranti K K Parisa [GetSet-India] <kranti.parisa@gmail.com>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: BatchUpdate exception
Date: Thu, 6 Dec 2007 15:12:22 +0530
Message-ID: <4478b4ac0712060142l2b185543y2d598d940e555c74@mail.gmail.com> (raw)
In-Reply-To: <Pine.BSO.4.64.0712060437550.6688@leary.csoft.net>
References: <4478b4ac0712050624u18cf3e8en81990c67ddf9da92@mail.gmail.com>
	<Pine.BSO.4.64.0712051035140.24930@leary.csoft.net>
	<4478b4ac0712050752kae43d65p46c5c08645d1e755@mail.gmail.com>
	<Pine.BSO.4.64.0712051055490.24930@leary.csoft.net>
	<4478b4ac0712050802g595852dcq8a1e2efb886c5853@mail.gmail.com>
	<4478b4ac0712052314p8a1875dm424b8e8c7645b0df@mail.gmail.com>
	<Pine.BSO.4.64.0712060437550.6688@leary.csoft.net>

Hi Kris,

I realized it after posting it and then i have changed it to the following

-----------------------------
CallableStatement proc=null;

        try{
            for (int i=0;i<200;i++){
                //System.out.println("inside outer==>>"+i);
                for(int j=0;j<4;j++){
                    //System.out.println("inside inner==>>"+j);
                    proc=con.prepareCall("{call test_function()}");
                    //proc.registerOutParameter(1, Types.INTEGER);
                    proc.addBatch();
                }
            }
            int []intUpdates=proc.executeBatch();
            System.out.println("intUpdates length==>>"+intUpdates.length);
            for(int i=0;i<intUpdates.length;i++){
                System.out.println("i number is==>>"+i);
                System.out.println("i value is==>>"+intUpdates[i]);
                al.add(new Integer(intUpdates[i]));
            }
        }catch(SQLException e){
            System.out.println(e.getNextException());
        }
--------------------------

But the output remains same, which is

----------
intUpdates length==>>1
i number is==>>0
i value is==>>0
test size===>>[0]

------------------

Please suggest

On Dec 6, 2007 3:09 PM, Kris Jurka <books@ejurka.com> wrote:

>
>
> On Thu, 6 Dec 2007, Kranti K K Parisa [GetSet-India] wrote:
>
> >            for (int i=0;i<200;i++){
> >                //System.out.println("inside outer==>>"+i);
> >                for(int j=0;j<4;j++){
> >                    proc=null;
> >                    //System.out.println("inside inner==>>"+j);
> >                    proc=con.prepareCall("{call
> > client255271111.test_function()}");
> >                    //proc.registerOutParameter(1, Types.INTEGER);
> >                    proc.addBatch();
> >                }
> >            }
> >            int []intUpdates=proc.executeBatch();
>
>
> Since you're reinitializing proc inside the loop you only end up adding
> one batch to it, so you only get one batch out.
>
> Kris Jurka
>



-- 
------------------
Best Regards
Kranti Kiran Kumar Parisa
Mobile: +91 - 9849 - 625 - 625
           +91 - 9391 - 438 - 738

view thread (8+ messages)  latest in thread

Message-ID: <4478b4ac0712060142l2b185543y2d598d940e555c74@mail.gmail.com>
Permalink:  ../4478b4ac0712060142l2b185543y2d598d940e555c74@mail.gmail.com/
Also on:    postgresql.org/message-id/4478b4ac0712060142l2b185543y2d598d940e555c74@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: kranti.parisa@gmail.com, books@ejurka.com
  Subject: Re: BatchUpdate exception
  In-Reply-To: <4478b4ac0712060142l2b185543y2d598d940e555c74@mail.gmail.com>
  References: <4478b4ac0712050624u18cf3e8en81990c67ddf9da92@mail.gmail.com> <Pine.BSO.4.64.0712051035140.24930@leary.csoft.net> <4478b4ac0712050752kae43d65p46c5c08645d1e755@mail.gmail.com> <Pine.BSO.4.64.0712051055490.24930@leary.csoft.net> <4478b4ac0712050802g595852dcq8a1e2efb886c5853@mail.gmail.com> <4478b4ac0712052314p8a1875dm424b8e8c7645b0df@mail.gmail.com> <Pine.BSO.4.64.0712060437550.6688@leary.csoft.net> <4478b4ac0712060142l2b185543y2d598d940e555c74@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox