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

Home -> Community -> Usenet -> c.d.o.misc -> Oracle 8.1.7 LONG RAW data not returning in ref cursor from stored procedure calls

Oracle 8.1.7 LONG RAW data not returning in ref cursor from stored procedure calls

From: themike <mike_at_cyberworksmedia.com>
Date: 6 Feb 2004 10:45:30 -0800
Message-ID: <78f1a884.0402061045.7baa57ad@posting.google.com>


I've seen this error posted elsewhere, but I have not seen any resolution stated. I have a java app running on WebSphere 4.0 that utilizes an Oracle 8.1.7 database. I am able to connect to the database fine and retreive all data except for LONG types. When I attepmt to retreive data from a LONG column, through any tequnique, I get an ArrayIndexOutOfBoundsException error. I am able to see that a LONG type column exists and to get the column number through analyzing the metadata returned in the recordset from the stored procedure, but I'm not able to get the data.

If I run the same code on WebSphere 5.0, utilizing the same Oracle 8.1.7 driver and JRE, I can access the data fine, which makes me think this maybe a WebSphere issue. However, I've seen other posts say this is due to a bug in Oracle's 8.1.7 drivers. Any Ideas?

My code looks like this, although I've tried to obtain the data from the LONG column in more ways than shown here (bytes, inputstream, etc...):



ServiceLocator locator = ServiceLocator.getInstance();

    Connection myConn = null;
    try {
      DataService ds = (DataService)
locator.getService(DataService.NAME);

      myConn = ds.getConnection();
    }
    catch (Exception ex) {
      System.out.println("Exception Caught: " + ex.getMessage());     }

    boolean result = false;
    CallableStatement callStmt = null;
    java.sql.ResultSet rs = null;
    try {
      callStmt = myConn.prepareCall("begin Baxter.sp_GetAllStaticContent(?); end;");

      callStmt.registerOutParameter(1,OracleTypes.CURSOR);

      //execute the
      result = callStmt.execute();
      rs = (ResultSet)callStmt.getObject(1);

        while( (rs != null) && (rs.next()) ){

          if(rs.getInt("NSTATICID") == 1){
            homelefttext = rs.getString("sBody"); // exception thrown
          }
          else if(rs.getInt("NSTATICID") == 2){
            byte[] bytes = rs.getBytes("SBODY"); // exception thrown
          }
          else if(rs.getInt("NSTATICID") == 3){
            homeflashtext = rs.getString("sBody"); // exception thrown
          }
        }


        callStmt.close();
        callStmt = null;

}
catch (Exception e) { System.err.println(e.toString());
}
finally { // Always make sure statements are closed, if (callStmt != null) { try { callStmt.close(); } catch (SQLException e) { ; } callStmt = null;
}
if (myConn != null) { try { myConn.close(); } catch (SQLException e) { ; } myConn = null;
}

    }


Received on Fri Feb 06 2004 - 12:45:30 CST

Original text of this message

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