aspose file tools*
The moose likes JDBC and the fly likes query select where Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "query select where" Watch "query select where" New topic
Author

query select where

Mark Miranda
Greenhorn

Joined: Feb 25, 2011
Posts: 24
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
Bartender

Joined: Oct 14, 2005
Posts: 18643
    
    8

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

Joined: Feb 25, 2011
Posts: 24
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

Joined: Mar 02, 2010
Posts: 63
Just wanted to say thanks, I couldn't get my query working the whole evening, but now it works!

Cheers,

Patrick


------------------8<------------------
please cut here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: query select where