From: rossel at peranto.de (Andreas Rossel) Date: Mon, 11 Feb 2008 11:10:49 +0100 Subject: [Pljava-dev] User defined Function Message-ID: <001201c86c96$60e713f0$a5c8a8c0@perantoarr> Hello, i?m new to pljava and the first I tried was creating a stored procedure in pljava. But it doesnt work. Here a quick walkthrough of my code: There is a package test with my (one and only) Java class TestPLJava. It has a main routine (which does nothing, but i seem to need it to generate the JAR) and my desired method ?einParameter? which should take one integer parameter and return a string. Here it is: package test; public class TestPLJava { public static java.lang.String einParameter(int in) { return "ein Parameter "+in; } public static void main(String[] args) { ; } } I declare / map the method within a SQLJDeploymentDescriptor which is: SQLActions[] = { "BEGIN INSTALL create function javatest.testeiner(integer) returns character varying as 'test.TestPLJava.einParameter' language java; select sqlj.set_classpath('javatest', 'PLJavaTest'); END INSTALL", "BEGIN REMOVE DROP FUNCTION javatest.testeiner(integer); END REMOVE" } I generate the JAR (with eclipse, my Java-IDE ? but this shouldn?t matter?) and install it with: select sqlj.install_jar('file:///c:/myDirectory/PLJavaTest.jar', 'PLJavaTest', true); And so far it works fine. In the pgAdmin tool I could find a function ?testeiner? which points to my java method. Even the classpath is set. But if I trie to call the function i get an error message. The command: select testeiner(1); Results in: ERROR: function testeiner(integer) does not exist SQL Status:42883 Hinweis:No function matches the given name and argument types. You may need to add explicit type casts. Zeichen:8 And calling: select javatest.testeiner(1); Returns: ERROR: java.lang.ClassNotFoundException: test.TestPLJave SQL Status:XX000 I am working with a PostgreSQL Database 8.2 on a Windows Server 2003 with Java 1.6.0_03. Thanks in advance, Andreas -------------- next part -------------- An HTML attachment was scrubbed... URL: