CachedRowSet works with ResultSets?
I have the following code that doesn't seem to work, where the stored procedure returns a result set (I've left exception handling out of this code for this post):
CachedRowSet crs =new CachedRowSetImpl();
crs.setCommand("{call getStuff(?)}");
crs.setDataSourceName("java:/comp/env/jdbc/mydb");
crs.setInt(1,Integer.parseInt(session.getAttribute("myAttr").toString()));
crs.execute();
If I iterate through the CachedRowSet, there's nothing there... Do you see any glaring problems with this code, or does it seem to be doing the right type of thing?
Thanks.
# 1
I've seen examples out there that pass "jdbc/mydb" to the setDataSourceName method as opposed to passing the entire string that I've passed. However, trying that causes a connection exception...
I haven't seen anything anywhere (including the JDBC spec) that says that I can't use a string representing a stored procedure in my setCommand method, so I'm guessing that's not the problem either.
If I change setInt to setInt(1,1) just to test, it also doesn't return anything.
I've also experimented with the order of the statements, putting setDataSourceName before setCommand, but nothing seems to work.
What should I do from here?
I seemed to already have had com.sun.rowset.CachedRowSetImpl as part of my Java distribution without having to download it separately from the Sun website - could that be a reason?