Why is it that java is crossing my path so much…

After a restore of a database on another node, including renaming him/her, java classes were invalid.
Example of the source code is at the bottom of this post by the way. RDBMS on Suse Linux 9.2.
Trying to create / replace them, errors popped up:

ORA-29516: Aurora assertion failure: Assertion failure at eox.c:317
Uncaught exception Root of all Java exceptions:

After some thoughts about the causes like the renaming, environment settings etc., decided to go for the ‘inelegant’ way, such as removing java from the database, and installing it again:

shutdown immediate

After that, creating the java source was no problem(!), but while compiling it got the generic error:
–> ORA-03113: end-of-file on communication channel

But then..
It appeares I was connected through sql*net.¬† Didn’t expect¬† it matters so much…
A direct connect on the server (sqlplus “/as sysdba”) and ‘alter java source BlobHandler compile; ‘ did the job.

Sample source:

create or replace java source named BlobHandler as
import java.lang.*;
import java.sql.*;
import oracle.sql.*;
import java.io.*;

public class BlobHandler {

public static void ExportBlob(String myFile, BLOB myBlob) throws Exception {
// Bind the image object to the database object
// Open streams for the output file and the blob
File binaryFile = new File(myFile);
FileOutputStream outStream = new FileOutputStream(binaryFile);
InputStream inStream = myBlob.getBinaryStream();

// Get the optimum buffer size and use this to create the read/write buffer
int size = myBlob.getBufferSize();
byte[] buffer = new byte[size];
int length = -1;

// Transfer the data
while ((length = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, length);

// Close everything down

alter java source BlobHandler compile;
show errors java source BlobHandler

create or replace procedure ExportBlob (p_file in varchar2, p_blob in blob)
as language java
name ‘BlobHandler.ExportBlob(java.lang.String, oracle.sql.BLOB)’;