The prepareAllSQLStatements build
descriptor option controls the kind of JDBC object that EGL uses to
run an SQL statement.
When you run SQL statements (other than stored procedure calls)
in a Java™ environment, the JDBC
API provides two different objects to send the SQL statements to the
database:
- PreparedStatement
- The object is derived from the Statement class, contains an SQL
statement, and allows parameters.
- Statement
- This more general object does not contain an SQL statement and
does not take parameters.
The object that EGL uses depends on a number of factors. EGL always
generates PreparedStatements for DB2® and
Derby. In most cases, PreparedStatements are more efficient because
they can be cached by the J2EE server and reused, but in other than
J2EE environments, PreparedStatements can degrade performance. For
this reason, the decision to force the use of PreparedStatements is
left as an option. The default value is NO, which means that EGL makes
the choice of which object to use.
Try both settings for your applications and see which gives you
better performance.
You might also be able to improve performance by caching PreparedStatements.
For details, see “cachePreparedStatements.”
Values
The prepareAllSQLStatements build
descriptor option has the following values:
- YES
- EGL uses the PreparedStatement object rather than the Statement
object to send SQL statements to the database. For DB2 and Derby, EGL always uses the PreparedStatement
object; setting the option to YES makes no difference.
- NO (the default value)
- EGL chooses between the Statement and PreparedStatement object
based on other factors.