Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in rs.getString()

 
Rakesh Keerthi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


Thanks.
 
chris webster
Bartender
Posts: 2407
33
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rakesh Keerthi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the answer Chris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic