This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Error Retreiving a resultset from an oracle stored procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error Retreiving a resultset from an oracle stored procedure" Watch "Error Retreiving a resultset from an oracle stored procedure" New topic
Author

Error Retreiving a resultset from an oracle stored procedure

sajag patel
Greenhorn

Joined: Dec 20, 2002
Posts: 7
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

Joined: Oct 11, 2000
Posts: 1121

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.
 
jQuery in Action, 2nd edition
 
subject: Error Retreiving a resultset from an oracle stored procedure
 
Similar Threads
Oracle9i wrong number or types of arguments in call to...
java.sql.SQLException: No data read
How to call stored procedure that returns a cursor
Error Type Mismatch
RegisterOutParameter Problem in java?