What Is ParameterMetaData? JDBC

ParameterMetaData(as an interface) is extracted from a PreparedStatement object using the PreparedStatement.getParameterMetaData() method. The ParameterMetaData interface provides a means to get metadata describing the input parameters (designated as a ? in a SQL statement) to a dynamically prepared statement. The SQL 92 and SQL 99 standards specify a DESCRIBE INPUT statement for dynamic SQL. The JDBC 3.0 specification (included in JDK 1.5) introduces a ParameterMetaData class and methods that correspond to DESCRIBE INPUT support. SQL’s DESCRIBE INPUT functionality is similar to ParameterMetaData—all parameter markers used in a prepared or call statement are described with the DESCRIBE INPUT statement, regardless of the mode of the formal parameter. You may use the SQL’s DESCRIBE INPUT statement to return input parameter information before a prepared statement is executed.

For example if you have a PreparedStatement object, which represents the following SQL query:
select id, name, age from employees where id > ? and age < ?then the ParameterMetaData object extracted from this PreparedStatement object (using PreparedStatement.getParameterMetaData()) will have metadata for two parameters:

  • id parameter (name="id",type= INTEGER, precision, …)
  • age parameter (name="age",type=INTEGER, precision, …)

Figure shows the relationships of PreparedStatement to ParameterMetaData.

relationships of Prepared Statement to Parameter Meta Data



Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JDBC Topics