This section lists some basic rules that developers should be aware of when developing any applications. A failure to follow the rules will result in a poorly performing application.
Database interaction best practices
Using Statement versus PreparedStatement versus CallableStatement
Choose between the Statement, PreparedStatement, and CallableStatement interfaces; it depends on how you plan to use the interface. The Statement interface is optimized for a single execution of an SQL statement, while the PreparedStatement object is optimized for SQL statements that will be executed multiple times, and CallableStatement is generally preferred for executing stored procedures:
- Statement: The PreparedStatement is used to execute...