Skip site navigation (1) Skip section navigation (2)

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 07:14:08
Message-ID: 4478b4ac0712052314p8a1875dm424b8e8c7645b0df@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hi Kris,

No Luck with that!

My Test java program look like this

------------
try{
            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();
            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());
        }
--------------------------

and SP look like
===========
CREATE OR REPLACE FUNCTION test_function()
  RETURNS int4 AS
$BODY$
 declare
begin
raise notice 'testing the Stored proc%','SP Tested';

return 1;
end;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION test_function() OWNER TO postgres;
========================

The results when i run the java program are:

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


which shows the SP is not getting executed for all the times??

please suggest.


On Dec 5, 2007 9:32 PM, Kranti K K Parisa [GetSet-India] <
kranti(dot)parisa(at)gmail(dot)com> wrote:

> excellent. let me try and update you
>
> thanks!
>
>
> On Dec 5, 2007 9:26 PM, Kris Jurka <books(at)ejurka(dot)com> wrote:
>
> >
> >
> > On Wed, 5 Dec 2007, Kranti K K Parisa [GetSet-India] wrote:
> >
> > > We are using Postgres 8.1 version. Does this mean we need to upgrade
> > the
> > > database version also? or can use the driver with latest release?
> > >
> >
> > You can use the 8.3 driver with any server version >= 7.2.
> >
> > Kris Jurka
> >
>
>
>
> --
> ------------------
> Best Regards
> Kranti Kiran Kumar Parisa
> Mobile: +91 - 9849 - 625 - 625
>            +91 - 9391 - 438 - 738
>



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

In response to

Responses

pgsql-jdbc by date

Next:From: Ken JohansonDate: 2007-12-06 07:26:53
Subject: Statement.executeUpdate(String sql, int columnIndexes[]) via RETURNING clause?
Previous:From: Ken JohansonDate: 2007-12-06 07:07:42
Subject: Re: Synthesize support for Statement.getGeneratedKeys()?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group