Skip to Content
avatar image
Former Member

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 (26.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Oct 27, 2015 at 08:44 AM

    Hi Lee,

    Does the function fail when called by its owner?

    If it fails only when called with different user then try recreate it with option "SQL SECURITY INVOKER"

    http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc00801.1604/doc/html/jcu1304529694510.html

    Add comment
    10|10000 characters needed characters exceeded