Prepared Statements
Much of the SQL that needs to be executed in an application can be handled with the execute(), executeQuery(), and executeUpdate() methods. However, each one of these methods requires the entire SQL string to be used as the input parameter. Aside from having to build the SQL statement, the application will need to deal with string constants. Strings within SQL statements are enclosed by single quotation marks ('). If a string contains single quotation marks or other control characters, it can be almost impossible to build an SQL statement.
During execution, an application will need to build the SQL statement dynamically and then submit it for processing. This process would have to be repeated each time, even if just one parameter ...
Get Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.