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

Home -> Community -> Usenet -> c.d.o.server -> JSP Data Type Mappings

JSP Data Type Mappings

From: Stan <sbrubaker_at_earthlink.net>
Date: Sun, 11 Jul 1999 12:28:19 -0600
Message-ID: <7mann9$j9p$1@oak.prod.itd.earthlink.net>


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);

}

}


CREATE OR REPLACE TYPE MYUSER.t_mydata AS OBJECT(   idnum NUMBER,
  name VARCHAR2(50),
  description VARCHAR2(50),
  created DATE,
  isdefault NUMBER(1),
  totalactions INTEGER
);


Dictionary map = this.connection.getTypeMap(); map.put("T_MYDATA", Class.forName("myjsp.MyData")); OracleCallableStatement stmt = (OracleCallableStatement)
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

Original text of this message

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