Stored Functions - Mailing list pgsql-jdbc

From Yolanda Phillips
Subject Stored Functions
Date
Msg-id 000701c36880$f6ee2290$2300800a@dlkapp.dlkconsulting.co.za
Whole thread Raw
Responses Re: Stored Functions
List pgsql-jdbc
Good day,

I urgently need help!!

I've just upgraded to postgresql-7.3.4. Using pg73jdbc3.jar driver. This is
because I really need to use stored functions.

This is the plpgsql function:

CREATE OR REPLACE FUNCTION LoadGlobals(INT) RETURNS refcursor AS '
DECLARE
   v_global_id ALIAS FOR $1;
   ref refcursor;
BEGIN

    OPEN ref FOR
        SELECT global_values_desc, section_title, menu_url, include_file_url
        FROM GLOBAL_VALUES
        WHERE global_values_id = v_global_id;
    --IF NOT FOUND THEN --If nothing was returned in the last query
      --RAISE EXCEPTION ''Invalid global id.'';
    --ELSE
      RETURN ref;
    --END IF;

END;
' LANGUAGE 'plpgsql';

The JDBC code:

private static final String driver = "org.postgresql.Driver";
  private static final String user = "someuser";
  private static final String pass = "password";
  private static final String dbURL =
"jdbc:postgresql://10.123.0.00/somedb";

 conn.setAutoCommit(false);
 CallableStatement proc = conn.prepareCall("{? = call LoadGlobals (?) }");
 proc.registerOutParameter(1, Types.OTHER);
 proc.setInt(2, sectionId);
 proc.execute();
 results = (ResultSet)proc.getObject(1);
 System.out.println("ResultSet: " + results);

 ...

I get the following error:
  SQL Exception: No class found for refcursor

Any suggestions?



Sincerely,


Yolanda Phillips
Web Applications Developer



pgsql-jdbc by date:

Previous
From: Derek S
Date:
Subject: Re: [BUGS] Bug #926: if old postgresql.jar in CLASSPATH,
Next
From: "srikanth nagaraju"
Date:
Subject: Re: Stored Functions