• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

query select where

 
Mark Miranda
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm new to using JDBC and for making a query select.... WHERE column = variable

how do you format the select statement?

this is what I have and the query doesn't work.


 
Paul Clapham
Sheriff
Pie
Posts: 20725
30
Eclipse IDE Firefox Browser MySQL Database
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't do it that way. Use a PreparedStatement which uses parametrized queries instead. Like this:


That's assuming that your employee_id column is actually declared as a text column in the database and not a numeric column.
 
Mark Miranda
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Don't do it that way. Use a PreparedStatement which uses parametrized queries instead. Like this:


That's assuming that your employee_id column is actually declared as a text column in the database and not a numeric column.


That make sense. thanks!
 
Patrick de Kruijf
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just wanted to say thanks, I couldn't get my query working the whole evening, but now it works!

Cheers,

Patrick
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic