agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] PlJava Function-Mapping
Date: Tue, 6 Sep 2011 20:37:24 -0700 (PDT)
Message-ID: <1315366644852-4777098.post@n5.nabble.com> (raw)
I seem to having problems writing a PLJava function-mapping. Consider the
code examples shown below that demonstrates in a very simple manner the
problem I am having:
*Consider I define the following PL Java function in PostgreSQL:*
CREATE OR REPLACE FUNCTION stringtest(character varying)
RETURNS tuple AS
'test.Org.getString'
LANGUAGE java VOLATILE
SELECT * FROM teststring(?hello?);
*The in Java I have:*
public class Org {
public static boolean getString(String input, ResultSet receiver)
throws SQLException{
String input_ = Common.getParam2();
receiver.updateString("first", input);
receiver.updateString("second", input_);
return true;
}
}
public class Common {
public static String getParam2(){
try {
Class.forName("org.postgresql.Driver");
Connection connection = DriverManager.getConnection(
"jdbc:postgresql://localhost:5432/mydb",
?username",
?password");
ResultSet rs = connection.createStatement().executeQuery(
"select id FROM events"
);
if(rs.next())
return rs.getString("id");
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
}
So now the problem is: if I don?t call /Common.param2()/ and instead just
hard-code some dummy-string everything works fine. But when I try calling
some other function, such as /.getParam2()/, I get an error, as follows:
/ ERROR: java.lang.NoClassDefFoundError: Could not initialize class
java.net.InetAddress/
Clearly the above is just the standard SDK, so this is really confusing me
as to why it is happening.
Any help would be much appreciated.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/PlJava-Function-Mapping-tp4777098p4777098.html
Sent from the PL/Java mailing list archive at Nabble.com.
view thread (2+ messages) latest in thread
Message-ID: <1315366644852-4777098.post@n5.nabble.com>
Permalink: ../1315366644852-4777098.post@n5.nabble.com/
Also on: postgresql.org/message-id/1315366644852-4777098.post@n5.nabble.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] PlJava Function-Mapping
In-Reply-To: <1315366644852-4777098.post@n5.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox