Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with syntax for SQL statement

 
Rob Petterson
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method below is used as part of a search facility for my web site. I'm getting this error message:
org.apache.jasper.JasperException: Column not found, message from server: "Unknown column 'origin' in 'where clause'"

This is my code for the method:


Country and Type are defined as columns within the exsisting table within the DB.
Any ideas?
[ May 03, 2003: Message edited by: Rob Petterson ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this instead:

String literals need to be single quoted. If you would be using a PreparedStatement, then you would not use the single quotes but with a regular Statement, you must.
 
Irene Loos
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually you have 2 errors in your SQL statement. Since origin, and coinType are parameters, try this:

[ May 03, 2003: Message edited by: Irene Loos ]
 
Rob Petterson
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Lasse and Irene for you're help. You were right Irene, there were a couple of mistakes in my syntax. You wouldn't believe how long I spent yesterday trying to figure it out! It works fine now. I've got one more of those methods to overload for a more complex search query, so at least now I've got a fair shot at getting it to work with your previous help. Thanks again.
[ May 04, 2003: Message edited by: Rob Petterson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic