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

Home -> Community -> Usenet -> c.d.o.tools -> Java Stored Procedure

Java Stored Procedure

From: Dennis Sandlin <dsandlin_at_mitre.org>
Date: 2000/04/14
Message-ID: <38F72BF4.1EAD2CA@mitre.org>#1/1

Hi,

I'm new to both Java and Oracle, but I'm trying to work with Java stored procedures anyway. I wrote a simple java class heavily based off an example in the Oracle documentation. I was able to successfully compile the ".java" file to create the ".class" file. I then try to load the ".class" file using the following command:

        loadjava -user name/passwd -v -resolve Prac.class

This returns the following:

	initialization complete
	resolver :
	Error while resolving class Prac
		ORA-00904: invalid column name

	loadjav: 1 errors

The message as well as the error code indicate a reference to an invalid column, however, I don't even reference a column by name. Here's the java class:

import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;

public class Prac {

	public static void addPrac(String first, String last, int age)
		throws SQLException {
		String sql = "INSERT INTO den_t VALUES (?,?,?)";
		try {
			Connection conn = new OracleDriver().defaultConnection();
			PreparedStatement pstmt = conn.prepareStatement(sql);
			pstmt.setString(1, first);
			pstmt.setString(2, last);
			pstmt.setInt(3, age);
			pstmt.executeUpdate();
			pstmt.close();
		} catch (SQLException e) {System.err.println(e.getMessage());}
	}

}

For the record, this is what den_t looks like:

SQL> describe den_t

 Name                                                  Null?    Type
 ----------------------------------------------------- --------
------------------------------------
 FIRST_NAME                                                    
VARCHAR2(20)
 LAST_NAME                                                     
VARCHAR2(20)
 AGE                                                           
NUMBER(3) SQL> spool off

Any help will be greatly appreciated.

Thanks in advance! Received on Fri Apr 14 2000 - 00:00:00 CDT

Original text of this message

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