agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feed[Pljava-dev] PostgresSQL 8.4 PL/Java IO access issue.
3+ messages / 0 participants
[nested] [flat]
* [Pljava-dev] PostgresSQL 8.4 PL/Java IO access issue.
@ 2011-09-04 10:19
2011-09-04 21:42 ` [Pljava-dev] PostgresSQL 8.4 PL/Java IO access issue.
0 siblings, 1 reply; 3+ messages in thread
From: @ 2011-09-04 10:19 UTC (permalink / raw)
Hello,
I am attempting to create a simple PL/Java function that checks where a file
exists or not but I am getting an IO error. Are there any security switches
I need to set when creating the PL/Java function or is there anything else I
am missing?
Code below...
Many thanks,
Marc :-)
//Java Code
public class FileExists
{
public static boolean checkFile (String input) throws Exception
{
String errorMessage;
try
{
// Check file exists and pass the value back thru the OUT paramenter
File f = new File(input);
return (f.exists());
}
catch (SecurityException ioe)
{
errorMessage = ioe.getMessage();
throw new Exception( errorMessage + " FAILED" );
}
}
}
-- PL/Java Wrapper Fuction
CREATE FUNCTION fileexists(character varying) RETURNS boolean
LANGUAGE java
AS $$FileExists.checkFile(java.lang.String)$$;
--Results
mydb=# select fileexists('/home/postgres/myfile.txt');
ERROR: java.lang.Exception: read on /home/postgres/myfile.txt FAILED
--
View this message in context: http://postgresql.1045698.n5.nabble.com/PostgresSQL-8-4-PL-Java-IO-access-issue-tp4767309p4767309.ht...
Sent from the PL/Java mailing list archive at Nabble.com.
^ permalink raw reply [nested|flat] 3+ messages in thread
* [Pljava-dev] PostgresSQL 8.4 PL/Java IO access issue.
2011-09-04 10:19 [Pljava-dev] PostgresSQL 8.4 PL/Java IO access issue.
@ 2011-09-04 21:42 `
2011-09-05 21:30 ` [Pljava-dev] PostgresSQL 8.4 PL/Java IO access issue.
0 siblings, 1 reply; 3+ messages in thread
From: @ 2011-09-04 21:42 UTC (permalink / raw)
marc_firth <marc.r.firth at gmail.com> writes:
>
> -- PL/Java Wrapper Fuction
> CREATE FUNCTION fileexists(character varying) RETURNS boolean
> LANGUAGE java
> AS $$FileExists.checkFile(java.lang.String)$$;
Use javau as the language. Then you don't have a security manager.
--
Johann Oskarsson http://www.2ndquadrant.com/ |[]
PostgreSQL Development, 24x7 Support, Training and Services --+--
|
Blog: http://my.opera.com/myrkraverk/blog/
^ permalink raw reply [nested|flat] 3+ messages in thread
* [Pljava-dev] PostgresSQL 8.4 PL/Java IO access issue.
2011-09-04 10:19 [Pljava-dev] PostgresSQL 8.4 PL/Java IO access issue.
2011-09-04 21:42 ` [Pljava-dev] PostgresSQL 8.4 PL/Java IO access issue.
@ 2011-09-05 21:30 `
0 siblings, 0 replies; 3+ messages in thread
From: @ 2011-09-05 21:30 UTC (permalink / raw)
Thanks! Setting to the untrusted language javaU works perfect :)
--
View this message in context: http://postgresql.1045698.n5.nabble.com/PostgresSQL-8-4-PL-Java-IO-access-issue-tp4767309p4772136.ht...
Sent from the PL/Java mailing list archive at Nabble.com.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2011-09-05 21:30 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-09-04 10:19 [Pljava-dev] PostgresSQL 8.4 PL/Java IO access issue.
2011-09-04 21:42 `
2011-09-05 21:30 `
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox