This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 152
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: 2296

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: 152
Thanks for the answer Chris
I agree. Here's the link:
subject: Error in rs.getString()
It's not a secret anymore!