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 in rs.getString() 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 in rs.getString()" Watch "Error in rs.getString()" New topic

Error in rs.getString()

Rakesh Keerthi
Ranch Hand

Joined: Jul 16, 2012
Posts: 136
Hi i have the below sql query in my servlet.

here when i use
rs.getString("Query_Answered ");

it is giving me the following error

here Query_Answered is present in the Scope_Demo table, could you please let me know what i should i use to get Query_Answered in rs.

chris webster

Joined: Mar 01, 2009
Posts: 1609

Rakesh Keerthi wrote:...

This is an SQLException and it's reporting an invalid column name, so I'd start by looking at the column names in your SQL. Is "Couunt1" a valid column name? How about the others? Also, you are not fetching the query_answered column in your outer SELECT, and why is your SQL nested anyway?

Take your SQL query and test it in your SQL interpreter shell before you put it into Java. That way you can be sure the query is correct.

No more Blub for me, thank you, Vicar.
Rakesh Keerthi
Ranch Hand

Joined: Jul 16, 2012
Posts: 136
Thanks for the answer Chris
I agree. Here's the link:
subject: Error in rs.getString()
Similar Threads
how to use <%=temp%> i retrieving data
Getting elements by id
Sql not working for multiple rows
How to replace a null with blank in jsp table
Help in MVC please