Home » Developer & Programmer » JDeveloper, Java & XML » Unknow Problem with JExcelAPI
icon8.gif  Unknow Problem with JExcelAPI [message #263580] Thu, 30 August 2007 07:59 Go to next message
psix666
Messages: 51
Registered: April 2007
Location: Azerbaijan
Member

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
workbook.write();
statement.

Someone can help me?

I will not say that this is urgent. Razz
Re: Unknow Problem with JExcelAPI [message #263628 is a reply to message #263580] Thu, 30 August 2007 09:34 Go to previous message
psix666
Messages: 51
Registered: April 2007
Location: Azerbaijan
Member

Hello Again.

Thanks for answers. Laughing

All the problem is in the JXL package, which use the latest version of jdk that Oracle 9iR2 got. I test same package on Oracle10g and it works great.

Thanks for everyone. If someone can slove that problem on Oracle9iR2 please tell me to.

My e-mail's are: Psix666 or MuradBagirov.
Previous Topic: How to rerieve ,add and delete data from XML files using jsp
Next Topic: newbie Getting a date of a text file
Goto Forum:
  


Current Time: Fri Mar 29 04:35:46 CDT 2024