This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error Retreiving a resultset from an oracle stored procedure

 
sajag patel
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic