Re: Experiences with pl/Java

From: Thomas <thomas(dot)k(dot)hill(at)t-online(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Experiences with pl/Java
Date: 2012-11-20 19:06:49
Message-ID: loom.20121120T200400-734@post.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dmitry Koterov 2012-11-20 19:25:19 Simple queries slowdown, maybe related to 3-minute long "<IDLE> in transaction"?
Previous Message Tom Lane 2012-11-20 19:05:01 Re: COPY FROM in psql