Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: [JDBC] BatchUpdate exception

From: Kranti K K Parisa [GetSet-India] <kranti.parisa(at)gmail.com>
Date: Thu Dec 06 2007 - 04:42:22 EST


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>"+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
Do you need help?X
Received on Thu Dec 6 04:45:18 2007

This archive was generated by hypermail 2.1.8 : Wed Jun 18 2008 - 23:41:00 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library