Oracle and Java packages

From: Alan <campbela_691021_at_my-deja.com>
Date: Mon, 29 Jan 2001 15:39:37 GMT
Message-ID: <9542ro$t3u$1_at_nnrp1.deja.com>


[Quoted] I have been trying to use the Java functionalility of the Oracle 8 database (8.1.6.0.0) but have been experiencing some problems.

I have a small demo package that will not 'run'



create or replace java source named "Postcode" as import java.io.*;
import java.net.*;
public class Postcode
{

static public int enquiry(String ipHost)
{
        Socket pcSocket = null;
        PrintWriter out = null;
       	BufferedReader in = null;
	String ipSendBuffer = null;
	String ipRecvBuffer = null;
	String tpHeader = "PC01000000000000";
	int ipPort = 7;
	pcSocket = new Socket(ipHost, ipPort);
	return 1;

}
}
/

When I execute the above command in SQL*Plus, it tells me 'Java created'. I then do the following :-

create or replace function postcode_enquiry(ipaddress varchar2) return number as
language java name 'Postcode.enquiry(java.lang.String) return java.lang.int';
/

This tells me that the function has been created. When I try to use the function :-

select postcode_enquiry('test') from dual;

I get the following error :-

ERROR at line 1:
ORA-29541: class CAMPBELA.Postcode could not be resolved

If I edit the Java routine and remove the line :-

        pcSocket = new Socket(ipHost, ipPort);

and try again, it works.
Obviously, its a fairly usless Java routine because it doesnt do anything.

I assume that the Java class failes to 'compile' because of the socket call, butI dont know why. Any ideas ?

Thanks

Alan

--
Alan Campbell
alanc_at_mullen.demon.co.uk


Sent via Deja.com
http://www.deja.com/
Received on Mon Jan 29 2001 - 16:39:37 CET

Original text of this message