Error: java.lang.SecurityException: execute on /home/<user>/test.sh JAR file trying to read shell file (Pljava)

253 Views Asked by At

I am trying to call a pl/Sql function which calls a Java class and it reads a shell file and execute the same. I placed this shell file in my home directory.

I created a JAR using that class and installed in PostgreSQL.

However, when trying to execute in PLJava, it returns the following error:

ERROR: java.lang.SecurityException: execute on /home//test.sh

********** Error **********

ERROR: java.lang.SecurityException: execute on /home//test.sh
SQL state: XX000

How to solve this?

1

There are 1 best solutions below

0
0x0FFF On

You cannot read and execute files from trusted PL/Java. You have to use untrusted language for this (i.e. javau), and you have to create the function under superuser