stored procedure and java

From: Jimmy P Mani <jimmymani(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: stored procedure and java
Date: 2005-02-10 13:12:58
Message-ID: 48f3cd3a05021005123c9b73d4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

hi all ,
i want to retrieve records from my java program

i am getting these exceptions
pls help me

No class found for refcursor
at org.postgresql.jdbc1.AbstractJdbc1Connection.getObject(AbstractJdbc1C
onnection.java:693)
at org.postgresql.jdbc2.AbstractJdbc2Connection.getObject(AbstractJdbc2C
onnection.java:117)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2Re
sultSet.java:147)
at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Stat
ement.java:329)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Stat
ement.java:48)
at UpdateFabric.update(UpdateFabric.java:64)
at UpdateFabric.main(UpdateFabric.java:50)

CREATE OR REPLACE FUNCTION public.aa() RETURNS refcursor AS 'declare
entrys refcursor; begin open entrys for select mat_no,po_no from
table; return entrys; end;
' LANGUAGE 'plpgsql' VOLATILE;

my java function is

public static void update()
{

try
{

CallableStatement s1 = con.prepareCall("{?=call aa()}");

s1.registerOutParameter(1,Types.OTHER);

s1.execute();
ResultSet rs1 = (ResultSet) s1.getObject(1);

while (rs1.next())
{

System.out.println((ResultSet)rs1.getObject(1));
}
rs1.close();
s1.close();

}catch(Exception e){e.printStackTrace();}

}

my connection string is

Class.forName("org.postgresql.Driver");

Connect = DriverManager.getConnection("jdbc:postgresql://ip/db","72093701","");

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

is this exception is due to any problem of pgsql driver.
if so where we will get the new driver.

please help me soon
thanks in advance

Browse pgsql-admin by date

  From Date Subject
Next Message KALODIKIS THODORIS 2005-02-10 14:47:02 Check user
Previous Message Steve Lane 2005-02-10 05:35:47 Re: PG 7.4: duplicate rows in violation of unique