prepareStatement(String sql)
Syntax:
PreparedStatement prepareStatement(String sql) throws SQLException
Description:
Creates a PreparedStatement
object for sending parameterized SQL statements to the database.
A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement
object. This object can then be used to efficiently execute this statement multiple times.
Result sets created using the returned PreparedStatement
object will by default be type TYPE_FORWARD_ONLY
and have a concurrency level of CONCUR_READ_ONLY
. The holdability of the created result sets can be determined by calling getHoldability()
.
Parameters:
sql
Type: String
an SQL statement that may contain one or more '?' IN parameter placeholders
Returns:
Type: PreparedStatement
a new default PreparedStatement
object containing the pre-compiled SQL statement
Throws:
SQLException - if a database access error occurs
Reference:
For more information, reference JDBC documentation for: Connection.prepareStatement(String)