• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error Retreiving a resultset from an oracle stored procedure

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Can anyone help me, and tell me why I am getting a javax.servlet.ServletException: No data read error.
Here's the code:
Connection c = null;
ResultSet rs = null;
CallableStatement cstmt = null;

try {
public static String GET_VALIDATEMESSAGE_STATEMENT = "call get_message(?, ?)";
cstmt = c.prepareCall(GET_VALIDATEMESSAGE_STATEMENT);
cstmt.registerOutParameter(2,OracleTypes.CURSOR);
cstmt.setInt(1, userID);
cstmt.execute();
if(!(cstmt.wasNull())){
rs = (ResultSet)cstmt.getObject(2);
while (rs.next()) {
System.out.println(rs.getString(1));
MessageCenter mes = new MessageCenter(rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4));
userMessages.add(mes);
}
}
rs.close();
//ps.close();
cstmt.close();
c.close();
Any help would be much appreciated.
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sajag,
Although I haven't tested your code, I believe you should change this line:

with this:

since Oracle supports the JDBC escape syntax.
Hope this helps.
Good Luck,
Avi.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic