Re: BatchUpdate exception

From: "Kranti K K Parisa [GetSet-India]" <kranti(dot)parisa(at)gmail(dot)com>
To: "Kris Jurka" <books(at)ejurka(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: BatchUpdate exception
Date: 2007-12-06 09:42:22
Message-ID: 4478b4ac0712060142l2b185543y2d598d940e555c74@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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(at)ejurka(dot)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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2007-12-06 09:47:33 Re: BatchUpdate exception
Previous Message Kris Jurka 2007-12-06 09:39:03 Re: BatchUpdate exception