The AS400JDBCParameterMetaData class enables your programs to retrieve information about the properties of parameters in PreparedStatement and CallableStatement objects.
AS400JDBCParameterMetaData provides methods that allow you to perform the following actions:
The following example shows one way to use AS400JDBCParameterMetaData to retrieve parameters from a dynamically generated PreparedStatement object:
// Get a connection from the driver. Class.forName("com.ibm.as400.access.AS400JDBCDriver"); Connection connection = DriverManager.getConnection("jdbc:as400://myAS400", "myUserId", "myPassword"); // Create a prepared statement object. PreparedStatement ps = connection.prepareStatement("SELECT STUDENTS FROM STUDENTTABLE WHERE STUDENT_ID= ?"); // Set a student ID into parameter 1. ps.setInt(1, 123456); // Retrieve the parameter meta data for the prepared statement. ParameterMetaData pMetaData = ps.getParameterMetaData(); // Retrieve the number of parameters in the prepared statement. // Returns 1. int parameterCount = pMetaData.getParameterCount(); // Find out what the parameter type name of parameter 1 is. // Returns INTEGER. String getParameterTypeName = pMetaData.getParameterTypeName(1);