Function with RETURN TYPE RECORD Called From JAVA

From: "Sumita Biswas" <sbiswas(at)cisco(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Cc: "'Kris Jurka'" <books(at)ejurka(dot)com>, "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "'Richard Huxton'" <dev(at)archonet(dot)com>
Subject: Function with RETURN TYPE RECORD Called From JAVA
Date: 2004-05-17 02:10:07
Message-ID: 016a01c43bb4$16978f80$dc656540@amer.cisco.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

I have a Function that returns a variable of Type RECORD.
PFA the .sql file in which the Function is written.

When I execute this Function from JAVA and try to get the Return
Variable in a ResultSet object I get the following Error:

Exception in thread "main" java.lang.ClassCastException
at com.cisco.ccm.car.general.Test.testStoredProc(Test.java:119)

Here is the JAVA Code that I am using:

---------------------------------------------------------------
CARConnector objCARConn = new CARConnector();
CallableStatement objCallStmt = null;

objCallStmt = objCARConn.prepareCall("{ ? = call
Proc_ConferenceSummary(?,?,?,?,?) }");
objCallStmt.registerOutParameter(1, 12);
// '12/1/2003','1/23/2004',1,1,0,5001
//'3/5/2004','3/5/2004',1,1,5001

objCallStmt.setString(2,"3/5/2004");
objCallStmt.setString(3,"5/5/2004");
//objCallStmt.setString(3,"3/5/2004");
objCallStmt.setInt(4,1);
objCallStmt.setInt(5,1);
objCallStmt.setInt(6,5001);
objCallStmt.execute();
ResultSet rs = (ResultSet)objCallStmt.getObject(1);//THIS IS
WHERE I GET THE CLASSCASTEXCEPTION
---------------------------------------------------------------

Please let me know in case I am doing something wrong, or there is a
different way of doing things.

Regards,
Sumita

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kris Jurka 2004-05-17 03:58:08 Re: Function with RETURN TYPE RECORD Called From JAVA
Previous Message Stephan Szabo 2004-05-17 02:02:19 Re: one to many