• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to pass parameter to CachedRowSet

 
D. Formenton
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a little, stupid problem.

If I execute thec following code ignoring the parameter s it work fine:

private void fillTable(String s){
SessionBean1 sb1 = getSessionBean1();
CachedRowSetXImpl rsp = sb1.getPersoneRowSet();
try{
rsp.setDataSourceName("java:comp/env/jdbc/public_PostgreSQL");
rsp.setCommand("SELECT p.idpersona, p.idtitolo as titolo,
p.cognome, p.nome FROM public.persone p where cognome > ?");
rsp.setString(1, 'P'); // Or other character, work fine!!!
rsp.execute();
} catch (SQLException e) {
e.printStackTrace();}
}

but if I replace with rsp.setString(1, s); to get te value of the string from the passed parameter it does not work.

Why?

(I have to re-create a new CachedRowSet for each query instead to get it from session bean?)

Thank you.

Domenico
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!