Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> First parameter caused an ORA-00932 in java stored procedure of 8i
Hi,
I tried to use a java.sql.Connection as the first parameter of my
procedure but
got following error
java.sql.SQLException: ORA-00932: inconsistent datatypes ORA-06512: at "COOLSHARE.CREATE_STUDENT2", line 0 ORA-06512: at line 1
Here is the procedure
import java.sql.*;
public class CreateStudent
{
public static void create(java.sql.Connection con, String studentId, String name, String age, String country)
{
}
}
I loaded the class by loadjava and published it with
CREATE OR REPLACE PROCEDURE CREATE_STUDENT2(STUDENTID VARCHAR2, NAME
VARCHAR2, AGE VARCHAR2, COUNTRY VARCHAR2)
AS LANGUAGE JAVA NAME
'CreateStudent.create(java.sql.Connection,
java.lang.String, java.lang.String, java.lang.String, java.lang.String)';
and calling it with
import java.sql.*;
public class Client
{
public static void main(String[]args)
{
Client app = new Client(); app.run();
public void run()
{
Connection con = getConnection(); try { CallableStatement cs = con.prepareCall("{Call CREATE_STUDENT2(?, ?, ?, ?)}" ); cs.setString(1, "14"); cs.setString(2, "gggg"); cs.setString(3, "24"); cs.setString(4, "xxxx"); cs.executeUpdate(); con.close(); } catch (Exception e) { System.err.println(e); try { con.close(); } catch (Exception ee) { System.err.println(ee); } }
}
static java.sql.Connection getConnection()
{
try { //Class.forName("oracle.jdbc.driver.OracleDriver"); DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); java.sql.Connection connection =DriverManager.getConnection("jdbc:oracle:thin:@24.12.9.172:1521:coocoo", "aaaa", "xxxzzz");
return connection; } catch (Exception e) { System.err.println("Failed to connect to DB:"+e); } return null;
The reason I thought the problem caused by the first parameter, java.sql.Connection is that if I remove the first parameter, it worked fine.
Any suggestion will be really appreciated.
Zhao Received on Fri Sep 07 2001 - 20:20:59 CDT