Java Reference
In-Depth Information
Table 10-2: Column Information Provided by getColumns()
Column Name
Type
Meaning
TABLE_SCHEM
String
table schema (may be null)
TABLE_NAME
String
table name
COLUMN_NAME
String
column name
DATA_TYPE
short
SQL type from java.sql.Types
TYPE_NAME
String
Data source dependent type name
COLUMN_SIZE
int
column size.
DECIMAL_DIGITS
int
the number of fractional digits
NUM_PREC_RADIX
int
Radix (typically either 10 or 2)
NULLABLE
int
 
columnNoNulls - might not allow NULL values
 
columnNullable - definitely allows NULL values
 
columnNullableUnknown - nullability unknown
REMARKS
String
comment describing column (may be null)
COLUMN_DEF
String
default value (may be null)
CHAR_OCTET_LENGTH
int
the maximum number of bytes in the column
ORDINAL_POSITION
int
index of column in table (starting at 1)
IS_NULLABLE
String  
"NO" means column definitely does not allow
NULLs.
 
"YES" means the column might allow NULL
values.
 
An empty string means nullability unknown.
In addition to information about the structure of the database, you will frequently find it useful to know
something about the capabilities of the RDBMS itself. The methods supported by the
DatabaseMetaData object to provide this type of information are discussed in the next section .
Retrieving Information about RDBMS Functionality
In addition to describing the structure of the database, the DatabaseMetaData object provides
methods to access to a great deal of general information about the RDBMS itself. Some of the
information you can retrieve about the database-management system is illustrated in Figure 10-3 .
The example shown in Figure 10-3 shows that the SQLServerContacts database is running under SQL
Server 7, using the Opta2000 pure Java driver from i-net Software. Also listed are some of the features
that this database configuration supports.
The elapsed time shown in the status bar is the time to access and display the tree view of the
DatabaseMetaData, as shown in Figure 10-2 . The difference between the elapsed time of just over two
seconds using the Opta2000 driver and nearly seven seconds using the jdbc-odbc bridge illustrated in
Figure 10-3 is significant. The code required to retrieve this information is shown in Listing 10-8 .
Listing 10-8: Retrieving information about the RDBMS
package JavaDatabaseBible.part2;
Search WWH ::




Custom Search