Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

JAVA Function Error

I get the following error when I run JAVA function:

=============================================

The following error occurred while fetching results:

Procedure 'hello' terminated with unhandled exception

'java.lang.Security Exception: File I/O not allowed'

SQLCODE=-91, ODBC 3 State='HY000"

=============================================

[OS Environment]

*  Linux testsvr 2.6.9-89.EL #1 Mon Apr 20 10:22:29 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

*  Java -version : java version "1.4.2_11"

*  Sybase Server Version : 12.7.0/ESD 12

[Java Source Code]

import java.io.FileInputStream;

public class Dummy {

        public static String hello(String str) throws Exception {

               FileInputStream fis = null;

               try {

                       fis = new FileInputStream("/app/sybase/Test/test.txt");

                       fis.read();

                       return str;

               } catch (Exception e) {

                       throw e;

               } finally {

                       if (fis != null) {

                              try {

                                      fis.close();

                              } catch (Exception e) {}

                       }

               }

        }

}

Function SQL

[SQL Statements]

Install java new from file '/app/sybase/Test/Dummy.class';

Create function testdummy(in name varchar(249)) returns varchar(255) external name 'Dummy.hello(Ljava/lang/String;)Ljava/lang/String;' language JAVA;

Select testdummy('abc');

Permission was granted permission from the top 777.

Any help would be really appreciated.

Thank you.

sybase_error.jpg (26788 B)
Not what you were looking for? View more on this topic or Ask a question