Re: Experiences with pl/Java

Поиск
Список
Период
Сортировка
От Thomas
Тема Re: Experiences with pl/Java
Дата
Msg-id loom.20121120T200400-734@post.gmane.org
обсуждение исходный текст
Ответ на Experiences with pl/Java  (Thomas Hill <Thomas.K.Hill@t-online.de>)
Список pgsql-general
have tested further combinations - without success - any other idea?


1st attempt (note: this implementation works on Apache Derby!)
===========

CREATE OR REPLACE FUNCTION rte."SP_getNextID"(OUT "iNextID" integer, IN
"vcIDName" character varying)
    RETURNS integer  LANGUAGE JAVA
  EXTERNAL SECURITY DEFINER AS
'onlyPostgreSQLPk.Functions.SP_getNextID(int[], String)'


    public static void SP_getNextID(int[] iNextVal, String vcIDName)
            throws SQLException {
        Connection conn = getDefaultConnection();

        // some JDBC code here

        return;

    }

Select rte."SP_getNextID"('xx');
==> result: FEHLER:  To many parameters - expected 1

********** Fehler **********

FEHLER: To many parameters - expected 1
SQL Status:42601



2nd attempt (omitting the signature in the function declaration)
===========

CREATE OR REPLACE FUNCTION rte."SP_getNextID"(OUT "iNextID" int, IN "vcIDName"
character varying)
    RETURNS integer  LANGUAGE JAVA
  EXTERNAL SECURITY DEFINER AS
'onlyPostgreSQLPk.Functions.SP_getNextID'

public static void SP_getNextID(int[] iNextVal, String vcIDName)
            throws SQLException {
        Connection conn = getDefaultConnection();

        // some JDBC code here

        return;

    }

Select rte."SP_getNextID"('Transaction');
==> result: FEHLER:  Unable to find static method
onlyPostgreSQLPk.Functions.SP_getNextID with signature (Ljava/lang/String;)I

********** Fehler **********

FEHLER: Unable to find static method onlyPostgreSQLPk.Functions.SP_getNextID
with signature (Ljava/lang/String;)I
SQL Status:XX000



3rd attempt (using int in the java method declarartion and in function signature)
===========

CREATE OR REPLACE FUNCTION rte."SP_getNextID"(OUT "iNextID" int, IN "vcIDName"
character varying)
    RETURNS integer  LANGUAGE JAVA
  EXTERNAL SECURITY DEFINER AS
'onlyPostgreSQLPk.Functions.SP_getNextID(int, String)'


public static void SP_getNextID(int iNextVal, String vcIDName)
            throws SQLException {
        Connection conn = getDefaultConnection();

        // some JDBC code here

        return;

    }

Select rte."SP_getNextID"('xx');
==> result: FEHLER:  To many parameters - expected 1

********** Fehler **********

FEHLER: To many parameters - expected 1
SQL Status:42601

5th attempt (using java.lang.Integer in the java method declarartion, integer in
function declaration and java.lang.Integer in function signature)
===========

CREATE OR REPLACE FUNCTION rte."SP_getNextID"(OUT "iNextID" integer, IN
"vcIDName" character varying)
    RETURNS integer  LANGUAGE JAVA
  EXTERNAL SECURITY DEFINER AS
'onlyPostgreSQLPk.Functions.SP_getNextID(java.lang.Integer, String)'


public static void SP_getNextID(java.lang.Integer iNextVal, String vcIDName)
            throws SQLException {
        Connection conn = getDefaultConnection();

        // some JDBC code here

        return;

    }

Select rte."SP_getNextID"('xx');
==> result: FEHLER:  To many parameters - expected 1

********** Fehler **********

FEHLER: To many parameters - expected 1
SQL Status:42601

Select rte."SP_getNextID"('xx');
==> result: FEHLER:  To many parameters - expected 1

********** Fehler **********

FEHLER: To many parameters - expected 1
SQL Status:42601


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: COPY FROM in psql
Следующее
От: Matthew Vernon
Дата:
Сообщение: Re: COPY FROM in psql