This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • 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: 20966
31
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