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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Java external procedure help?

RE: Java external procedure help?

From: Robert Freeman <robertgfreeman_at_yahoo.com>
Date: Sun, 11 Jun 2006 22:00:04 -0600
Message-ID: <KEEDIPJOJLCHPPAIDPDOCEOLCCAA.robertgfreeman@yahoo.com>


Ok, I need more help. I can now get the procedure to execute from Oracle without an error, but it's not creating the output file (c:\java\myfile.txt). When I run the procedure from java directly, it does create the output file, so the program itself is OK.

Any ideas?

Here is the Java:

import java.io.*;
class FileOutputDemo
{

        public static void main(String args[])
        {
                FileOutputStream out; // declare a file output object
                PrintStream p; // declare a print stream object
                try
                {

// Create a new file output stream
// connected to "myfile.txt"
out = new FileOutputStream("c:\\java\\myfile.txt");
// Connect print stream to the output stream
p = new PrintStream( out ); p.println ("This is written to a file"); p.close(); } catch (Exception e) { System.err.println ("Error writing to file"); } }

}

-----Original Message-----
From: Christian Antognini [mailto:Christian.Antognini_at_trivadis.com] Sent: Sunday, June 11, 2006 2:21 PM
To: robertgfreeman_at_yahoo.com
Cc: oracle-l_at_freelists.org
Subject: RE: Java external procedure help?

Robert

>Create or replace procedure test_write
>is
>language java
>name 'FileOutputDemo(java.lang.String)';

You have to problems here:
- you reference the class instead of the method (main is not "recognized"...)
- the parameter must be an array

Therefore the following should work:

Create or replace procedure test_write
is
language java
name 'FileOutputDemo.main(java.lang.String[])';

HTH
Chris

--
http://www.freelists.org/webpage/oracle-l
Received on Sun Jun 11 2006 - 23:00:04 CDT

Original text of this message

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