Section 12.2. Metadata

   

12.2 Metadata

The JDBC specification features a ResultSetMetaData object that can be used to get metadata regarding a result set.

The following code example from the API creates a result set and then creates a ResultSetMetaData object. It uses the MetaData object to determine how many columns are in the result set and whether the first column can be used in a WHERE clause.

 ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2"); ResultSetMetaData rsmd = rs.getMetaData(); int numberOfColumns = rsmd.getColumnCount(); boolean b = rsmd.isSearchable(1); 

To find out more about what methods are available to a ResultSetMetaData object, I encourage you to visit the java.sql package in the API and work with this class further.


   
Top


Java for ColdFusion Developers
Java for ColdFusion Developers
ISBN: 0130461806
EAN: 2147483647
Year: 2005
Pages: 206
Authors: Eben Hewitt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net