This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes rs.getstring not working. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "rs.getstring not working." Watch "rs.getstring not working." New topic

rs.getstring not working.

swapna jhanjhar

Joined: Oct 03, 2010
Posts: 8
I'm facing one strange problem. Donno the reason for the error.
I've one jsp page where I'm showing few values from db.
The servlet returns one resultset which has (say) name and id cols.
I've one hidden field and 2 textboxes.
if i'm doing in jsp page

it's throughing error that "no data found"


tis works fine..
From this it seems that we cant retrieve value from one RS column more than once.,...
can anyone please let me know the reason...and how can i achieve the same ???
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32819

Some database drivers don't let you retrieve a column more than once. The solution is to store it in variable.

Note that it is considered horrible practice to have JDBC code inside a JSP. It is better to call JDBC from a class called indirectly from your servlet and store the results in a request attribute. Then the JSP reads that attribute.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Consider Paul's rocket mass heater.
subject: rs.getstring not working.
jQuery in Action, 3rd edition