If you have to execute the SQL command more then once, prepared statements are certainly faster. But it is always a good idea to use [tt]PreparedStatement[/tt], because your second code is vulnerable to SQL injection. ( Unless you do not take care of it other way. ) By handling [tt]String[/tt]s with [tt]PreparedStatement[/tt] you reduce the possibility to run into character set mismatch problems.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.