Hi dear All.
1. I load JXL package to database using
loadjava -v -r user_name/pass@sid -r jxl.jar
2. I have created stored procedure in oracle as follows:
create or replace and compile java source named createReport as
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import java.io.File;
public class createReport {
private static String filePath;
private static String fileName;
//for excel writing
private static WritableSheet sheet;
private static Label label;
private static WritableWorkbook workbook;
private static String runReportByRows() {
try{
int fileIndex = 0;
workbook = Workbook.createWorkbook(new File(filePath+fileName+"_"+fileIndex+".xls"));
sheet = workbook.createSheet("Sheet"+fileIndex, 0);
label = new Label(1, 1 ,"TEST");
sheet.addCell(label);
workbook.write();
workbook.close();
return "OK";
} catch (Exception e){
return "Error: "+ e.toString();
}
}
public static String createReport(String filePath1,String fileName1){
filePath = filePath1;
fileName = fileName1;
String selectStatement = "";
try {
String returnedString = runReportByRows();
return returnedString;
} catch (Exception e) {
return "Error: "+ e.toString();
}
}
}
/
create or replace function Func_createReport(filePath String, fileName String) return varchar2
is language java name
'createReport.createReport(java.lang.String,java.lang.String) return java.lang.String';
/
3. I have granted permissions to my user from sys account to folder in which i want to create file:
BEGIN
DBMS_JAVA.GRANT_PERMISSION ( 'user_name', 'java.io.FilePermission','C:\temp\', 'read,write' );
COMMIT;
END;
/
4. I call procedure:
declare
str varchar2(1000);
begin
str := odb.func_createReport('c:/temp/','test');
dbms_output.put_line(str);
end;
I get following error:
Quote: |
call was terminated by uncaught Java exception: java.lang.AbstractMethodError: Error detected by bytecode verifier when class was created
|
I create additional table and insert rows to that table from different places in code and i see that the error happens on statement.
Someone can help me?
I will not say that this is urgent.