Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> JSP Data Type Mappings
I've been trying to use Java Stored Procedures in a project I did for a
client to test its feasibility. I'm using the SQLData interface and haven't
been able to get it to work. I get the following error when I run it...
java.SQLException: Failed to convert to internal to internal representation: myjsp/mydata_at_65244012
The JSP loads into the database just fine. I can even access the stored procedure from JDBC, but when I try to pass an SQLData class to it, I get the above error. I'm thinking it has something to do with the data type mappings. Below is my class, the object type I defined in my database, and the code I used to call it with JDBC.
Anybody have any ideas? Also, do readSQL and writeSQL handle nulls properly?
Thanks in advance for any help,
STAN package myjsp;
import java.sql.*;
public class MyData implements SQLData {
private long id = 0;
private String name = "";
private String description = "";
private Date created = new Date(0);
private boolean isDefault = false;
private int totalActions = 0;
public MyData() {}
public MyData(long id) {
this.sqlType = "T_MYDATA";
this.id = id;
}
private String sqlType;
public String getSQLTypeName() throws SQLException {
return sqlType;
}
public void readSQL(SQLInput stream, String typeName) throws SQLException
{
super.readSQL(stream, typeName);
id = stream.readLong();
name = stream.readString();
description = stream.readString();
created = stream.readDate();
isDefault = stream.readBoolean();
totalActions = stream.readInt();
}
public void writeSQL(SQLOutput stream) throws SQLException {
stream.writeLong(id); stream.writeString(name); stream.writeString(description); stream.writeDate(created); stream.writeBoolean(isDefault); stream.writeInt(totalActions);
this.connection.prepareCall("{? = GENERATE_ACTIONS(?)}"); stmt.setObject(2, data, OracleTypes.STRUCT); stmt.registerOutParameter(1, OracleTypes.NUMBER); stmt.execute();Received on Sun Jul 11 1999 - 13:28:19 CDT