This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
i have used the sql statement in prepared statement like this connection.preparestatement("update x set col="+name+" where empno="+emp); what will happen if you write the prepared statement like this . is this statement compiled once and pass the values from next time onwords
You can invoke the execute methods on the same PreparedStatement object any number of times and the SQL is only compiled once. In your example you would not be able to change the values of name or emp as they would have been compiled into the statement when the PreparedStatement was created. You can create a variable in a statement by using a ?, then using PreparedStatement.setXXX() to change the value between executions. Read more about PreparedStatement in the Java Tutorial