FileDocCategorySizeDatePackage
ResultSetMetaData.javaAPI DocJava SE 5 API9185Fri Aug 26 14:57:20 BST 2005java.sql

ResultSetMetaData

public interface ResultSetMetaData
An object that can be used to get information about the types and properties of the columns in a ResultSet object. The following code fragment creates the ResultSet object rs, creates the ResultSetMetaData object rsmd, and uses rsmd to find out how many columns rs has and whether the first column in rs 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);

Fields Summary
int
columnNoNulls
The constant indicating that a column does not allow NULL values.
int
columnNullable
The constant indicating that a column allows NULL values.
int
columnNullableUnknown
The constant indicating that the nullability of a column's values is unknown.
Constructors Summary
Methods Summary
public java.lang.StringgetCatalogName(int column)
Gets the designated column's table's catalog name.

param
column the first column is 1, the second is 2, ...
return
the name of the catalog for the table in which the given column appears or "" if not applicable
exception
SQLException if a database access error occurs

public java.lang.StringgetColumnClassName(int column)

Returns the fully-qualified name of the Java class whose instances are manufactured if the method ResultSet.getObject is called to retrieve a value from the column. ResultSet.getObject may return a subclass of the class returned by this method.

param
column the first column is 1, the second is 2, ...
return
the fully-qualified name of the class in the Java programming language that would be used by the method ResultSet.getObject to retrieve the value in the specified column. This is the class name used for custom mapping.
exception
SQLException if a database access error occurs
since
1.2

public intgetColumnCount()
Returns the number of columns in this ResultSet object.

return
the number of columns
exception
SQLException if a database access error occurs

public intgetColumnDisplaySize(int column)
Indicates the designated column's normal maximum width in characters.

param
column the first column is 1, the second is 2, ...
return
the normal maximum number of characters allowed as the width of the designated column
exception
SQLException if a database access error occurs

public java.lang.StringgetColumnLabel(int column)
Gets the designated column's suggested title for use in printouts and displays.

param
column the first column is 1, the second is 2, ...
return
the suggested column title
exception
SQLException if a database access error occurs

public java.lang.StringgetColumnName(int column)
Get the designated column's name.

param
column the first column is 1, the second is 2, ...
return
column name
exception
SQLException if a database access error occurs

public intgetColumnType(int column)
Retrieves the designated column's SQL type.

param
column the first column is 1, the second is 2, ...
return
SQL type from java.sql.Types
exception
SQLException if a database access error occurs
see
Types

public java.lang.StringgetColumnTypeName(int column)
Retrieves the designated column's database-specific type name.

param
column the first column is 1, the second is 2, ...
return
type name used by the database. If the column type is a user-defined type, then a fully-qualified type name is returned.
exception
SQLException if a database access error occurs

public intgetPrecision(int column)
Get the designated column's number of decimal digits.

param
column the first column is 1, the second is 2, ...
return
precision
exception
SQLException if a database access error occurs

public intgetScale(int column)
Gets the designated column's number of digits to right of the decimal point.

param
column the first column is 1, the second is 2, ...
return
scale
exception
SQLException if a database access error occurs

public java.lang.StringgetSchemaName(int column)
Get the designated column's table's schema.

param
column the first column is 1, the second is 2, ...
return
schema name or "" if not applicable
exception
SQLException if a database access error occurs

public java.lang.StringgetTableName(int column)
Gets the designated column's table name.

param
column the first column is 1, the second is 2, ...
return
table name or "" if not applicable
exception
SQLException if a database access error occurs

public booleanisAutoIncrement(int column)
Indicates whether the designated column is automatically numbered, thus read-only.

param
column the first column is 1, the second is 2, ...
return
true if so; false otherwise
exception
SQLException if a database access error occurs

public booleanisCaseSensitive(int column)
Indicates whether a column's case matters.

param
column the first column is 1, the second is 2, ...
return
true if so; false otherwise
exception
SQLException if a database access error occurs

public booleanisCurrency(int column)
Indicates whether the designated column is a cash value.

param
column the first column is 1, the second is 2, ...
return
true if so; false otherwise
exception
SQLException if a database access error occurs

public booleanisDefinitelyWritable(int column)
Indicates whether a write on the designated column will definitely succeed.

param
column the first column is 1, the second is 2, ...
return
true if so; false otherwise
exception
SQLException if a database access error occurs

public intisNullable(int column)
Indicates the nullability of values in the designated column.

param
column the first column is 1, the second is 2, ...
return
the nullability status of the given column; one of columnNoNulls, columnNullable or columnNullableUnknown
exception
SQLException if a database access error occurs

public booleanisReadOnly(int column)
Indicates whether the designated column is definitely not writable.

param
column the first column is 1, the second is 2, ...
return
true if so; false otherwise
exception
SQLException if a database access error occurs

public booleanisSearchable(int column)
Indicates whether the designated column can be used in a where clause.

param
column the first column is 1, the second is 2, ...
return
true if so; false otherwise
exception
SQLException if a database access error occurs

public booleanisSigned(int column)
Indicates whether values in the designated column are signed numbers.

param
column the first column is 1, the second is 2, ...
return
true if so; false otherwise
exception
SQLException if a database access error occurs

public booleanisWritable(int column)
Indicates whether it is possible for a write on the designated column to succeed.

param
column the first column is 1, the second is 2, ...
return
true if so; false otherwise
exception
SQLException if a database access error occurs