This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
String s = "kpreddy"; String query = "SELECT UserId FROM Security WHERE UserId =" + s; PreparedStatement stmt = dbconn.prepareStatement(query); ResultSet rs = stmt.executeQuery(); When I run this queary I get too few parameters. Please tell me how to pass a host variable to select queary. Thanks In Advance. Pratap
if you are building a SQL statement it has to be well formed. The result you will get will look like: SELECT UserId FROM Security WHERE UserId =kpreddy kpreddy has to be in quotes! You need to do something like: String query = "SELECT UserId FROM Security WHERE UserId ='" + s + "'";