72 lines
4.1 KiB
HTML
72 lines
4.1 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="reference" />
|
|
<meta name="DC.Title" content="AS400JDBCParameterMetaData class" />
|
|
<meta name="abstract" content="" />
|
|
<meta name="description" content="" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="jdbcparmmetadata" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>AS400JDBCParameterMetaData class</title>
|
|
</head>
|
|
<body id="jdbcparmmetadata"><a name="jdbcparmmetadata"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">AS400JDBCParameterMetaData class</h1>
|
|
<div><p></p>
|
|
<div class="section"><p>The <a href="javadoc/com/ibm/as400/access/AS400JDBCParameterMetaData.html#NAVBAR_TOP"> AS400JDBCParameterMetaData</a> class enables
|
|
your programs to retrieve information about the properties of parameters
|
|
in PreparedStatement and CallableStatement objects.</p>
|
|
<p>AS400JDBCParameterMetaData
|
|
provides methods that allow you to perform the following actions:</p>
|
|
<ul><li><a href="javadoc/com/ibm/as400/access/AS400JDBCParameterMetaData.html#GETPARAMETERCLASSNAME(INT)">Get the class name of the parameter</a></li>
|
|
<li><a href="javadoc/com/ibm/as400/access/AS400JDBCParameterMetaData.html#GETPARAMETERCOUNT()">Get the number of parameters</a> in the PreparedStatement</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/AS400JDBCParameterMetaData.html#GETPARAMETERTYPE(INT)">Get the SQL type of the parameter</a></li>
|
|
<li><a href="javadoc/com/ibm/as400/access/AS400JDBCParameterMetaData.html#GETPARAMETERTYPENAME(INT)">Get the database-specific type name for the parameter</a></li>
|
|
<li><a href="javadoc/com/ibm/as400/access/AS400JDBCParameterMetaData.html#GETPRECISION(INT)">Get the precision</a> or <a href="javadoc/com/ibm/as400/access/AS400JDBCParameterMetaData.html#GETSCALE(INT)">the scale</a> of the parameter</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Example: Using AS400JDBCParameterMetaData</h4><p>The following
|
|
example shows one way to use AS400JDBCParameterMetaData to retrieve parameters
|
|
from a dynamically generated PreparedStatement object:</p>
|
|
<pre> // 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);</pre>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |