Java Stored Procedure
Date: 2000/04/14
Message-ID: <38F72BF4.1EAD2CA_at_mitre.org>#1/1
Hi,
[Quoted] 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) AGENUMBER(3) SQL> spool off
Any help will be greatly appreciated.
Thanks in advance! Received on Fri Apr 14 2000 - 00:00:00 CEST