Runtime error ORA-29515 [message #597233] |
Tue, 01 October 2013 18:37 |
|
orabert
Messages: 5 Registered: October 2013
|
Junior Member |
|
|
Hi,
I'm kinda new to Java within Oracle, so i realize i could be doing this all wrong.
When i compile the code below, it all compiles happily with no errors.
But when i run the PL/SQL block to call the procedure, it returns the errors:
ORA-29515: exit called from Java code with status 2
ORA-06512: at "MYSCHEMA.IMPORTFILESJAVA", line 1
ORA-06512: at line 2
The official definition of the ORA-29515 error is that my code contains a call to java.lang.Runtime.exitInternal, but i don't see any kind of System.exit type of call anywhere in my Java code... What am i missing?
Thanks!
Java source:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.*;
public class ImportFiles_form
{
//Create a JPanel to put combo boxes and labels in
JPanel cboPanel = new JPanel(new GridLayout(0,2,10,10));
// Create components to put in the JPanel
JLabel dataset_lbl = new JLabel("Dataset:");
String[] datasetNames = runQuery("SELECT DISTINCT dataset FROM data_files");
JComboBox dataset_cbo = new JComboBox(datasetNames);
JLabel region_lbl = new JLabel("Region:");
String[] regionNames = runQuery("SELECT DISTINCT region FROM data_files ORDER BY region");
JComboBox region_cbo = new JComboBox(regionNames);
JButton import_btn = new JButton("Import files");
//Constructor
public void ImportFiles_form()
{
//set default values for combo boxes
dataset_cbo.setSelectedIndex(0);
region_cbo.setSelectedIndex(0);
//Create a button listener
import_btn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
//Call the actual operation to import files
//...nothing here yet...
}
});
cboPanel.add(dataset_lbl);
cboPanel.add(dataset_cbo);
cboPanel.add(region_lbl);
cboPanel.add(region_cbo);
cboPanel.add(import_btn);
}
public String[] runQuery(String query)
//execute a database query and return a single string array of results
{
try
{
Connection cnxn = DriverManager.getConnection("jdbc:default:connection:");
Statement stmt = cnxn.createStatement();
ResultSet rset = stmt.executeQuery(query);
//create an ArrayList to hold the results
ArrayList queryResults = new ArrayList();
while(rset.next())
{
queryResults.add(rset.getString(1));
}
//convert the ArrayList to a String[] array
String[] rval = new String[ queryResults.size() ];
queryResults.toArray( rval );
stmt.close();
cnxn.close();
//return the String[] array
return rval;
}
catch (SQLException se)
{
String[] errMsg = { "ERROR: SQL Exception:" + se.getErrorCode() + "; Message: " + se.getMessage() };
return errMsg;
}
}
public static void showForm()
{
//Construct the class object
ImportFiles_form importTheFiles = new ImportFiles_form();
//Create JFrame
JFrame frame = new JFrame("Import Files");
frame.getContentPane().add(importTheFiles.cboPanel);
frame.pack();
frame.setVisible(true);
}
}
Oracle procedure:
CREATE OR REPLACE PROCEDURE JavaImportFiles
AS
LANGUAGE JAVA
NAME 'ImportFiles_form.showForm()';
PL/SQL:
BEGIN
JavaImportFiles;
END;
[Updated on: Wed, 02 October 2013 13:40] Report message to a moderator
|
|
|
|
|
Re: Runtime error ORA-29515 [message #598829 is a reply to message #597363] |
Thu, 17 October 2013 17:33 |
|
orabert
Messages: 5 Registered: October 2013
|
Junior Member |
|
|
It means that, as much as i can write all kinds of code using AWT objects, as soon as i try to instantiate an AWT object (i.e. by calling its constructor), that's the same as "materializing a GUI on the server", and hence, not supported by the Java virtual machine.
(simply put: the contents of my 'showForm()' procedure (above) are not permitted inside the JVM.)
If i want to create a GUI, i have to instantiate it outside of the JVM.
[Updated on: Fri, 18 October 2013 11:05] Report message to a moderator
|
|
|