Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: call java class in pl*sql

Re: call java class in pl*sql

From: Carlos <miotromailcarlos_at_netscape.net>
Date: 3 Feb 2005 23:30:08 -0800
Message-ID: <1de5ebe7.0502032330.4c0d08c3@posting.google.com>


"h" <heba11282_at_yahoo.com> wrote in message news:<1107448450.808797.171030_at_z14g2000cwz.googlegroups.com>...
> HI,
>
>
> "i want to create file .xls from pl*sql but i don't want it =ADto be in
> slk or csv format as i want to 've rows with background colo=ADr & these
>
> fromats doesn't support this "
>
>
> & i got some help from OTN dbforum
> " With just pl/sql you cannot create xls files. You can use =ADJava.
> Here
> you can find some demo's:
> http://www.andykhan.com/jexcelapi/ "
>
>
> then i do this
>
>
> THIS IS MY CLASS WHICH CALL jexcel API jar :
>
>
> package ExcelGenPackage;
> import java.io.File;
> import java.io.IOException;
> import java.lang.Number;
> import java.util.Date;
> import jxl.*;
> import jxl.write.*;
>
>
> public class ExcelGenClass
> {
> public ExcelGenClass()
> {
>
>
>
> }
>
>
> /**
> *
> * @param args
> */
> public static void main(String[] args)
> {
> ExcelGenClass excelGenClass =3D new ExcelGenClass();
> Write_XLS();
>
> }
>
>
> public static void Write_XLS()
> {
> try
> {
> WritableWorkbook workbook =3D Workbook.createWorkbook(new
> File("C:\\output.xls"));
> WritableSheet sheet =3D workbook.createSheet("First Sheet", 0)=AD;
> Label label =3D new Label(0, 2, "A label record");
> sheet.addCell(label);
>
> Label label1 =3D new Label(0, 4, "A Second label record ");
> sheet.addCell(label1);
>
>
> // All sheets and cells added. Now write out the workbook
> workbook.write();
> workbook.close();
>
>
>
> }
>
>
> catch (JXLException e)
> {
> System.out.println("JXLException ");
>
> }
>
>
> catch (IOException e)
> {
> System.out.println("IOException ");
>
>
> }
> }
> }
>
>
> I Load the jar & the class into pl*sql
> then i add wrapped procedure
>
> PROCEDURE Test_Proc AS LANGUAGE JAVA
> NAME 'ExcelGenPackage.ExcelGenClass.Write_XLS()';
>
>
> when i call Test_Proc
> i got this exception
>
>
> ORA-29532: Java call terminated by uncaught Java exception:
> java.lang.IncompatibleClassChangeError: Error detected by by=ADtecode
> verifier when class was created=20
>
>
> please help

new File("C:\\output.xls"));

Oracle user must have permission to write a file in C:\ ('C:\output.xls') via java permissions (DBMS_JAVA).

HTH. Carlos Received on Fri Feb 04 2005 - 01:30:08 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US