This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes How to pass parameter to CachedRowSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to pass parameter to CachedRowSet" Watch "How to pass parameter to CachedRowSet" New topic
Author

How to pass parameter to CachedRowSet

D. Formenton
Ranch Hand

Joined: Mar 20, 2008
Posts: 47
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to pass parameter to CachedRowSet