Hitachi

Hitachi Advanced Database Application Development Guide


8.6.17 getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)

Organization of this subsection

(1) Function

This method acquires information about table columns.

The information about table columns that can be acquired depends on the privileges of the HADB user who executes this method. For details about the privileges and the table column information that can be acquired, see the topic Scope of information in dictionary tables and system tables that can be referenced by HADB users in the HADB Setup and Operation Guide.

(2) Format

public synchronized ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException

(3) Arguments

String catalog

Specifies a catalog name. This argument is ignored, if specified.

String schemaPattern

Specifies a schema name pattern#. This value is case sensitive.

String tableNamePattern

Specifies a table name pattern#. This value is case sensitive.

String columnNamePattern

Specifies a column name pattern#. This value is case sensitive.

#

For details about the special characters that can be specified in each pattern, see (4) Special characters that can be specified in pattern character strings in 8.6.1 List of the methods in the DatabaseMetaData interface.

(4) Return value

The method returns a ResultSet object. The following table shows the format of the ResultSet object that is returned.

Table 8‒48: Format of the ResultSet object that is returned (getColumns method)

Column No.

Type

Column name

Description

1

String

TABLE_CAT

The method always returns a null character string.

2

String

TABLE_SCHEM

Schema name

3

String

TABLE_NAME

Table name

4

String

COLUMN_NAME

Column name

5

int

DATA_TYPE

SQL type

6

String

TYPE_NAME

Type name

7

int

COLUMN_SIZE

Column size

8

int

BUFFER_LENGTH

The null value is always returned.

9

int

DECIMAL_DIGITS

Decimal places

10

int

NUM_PREC_RADIX

Radix

  • Approximate value: 2

  • Exact numeric value: 10

  • Non-numeric value: 0

11

int

NULLABLE

Value indicating whether the NULL value is permitted:

  • columnNoNulls: The null value might not be permitted.

  • columnNullable: The null value can be used.

12

String

REMARKS

Comment column

The method always returns a null character string.

13

String

COLUMN_DEF

The default value of the column is returned.

  • If the returned value is enclosed by single quotation marks ('), it means that the default value is a character string.

  • If NULL is specified as the default value of the column, the character string NULL is returned without single quotation marks (').

  • If no default value is specified for the column, a null value is returned.

  • For details about other return values, see the description of the DEFAULT_VALUE column in the table Content of SQL_COLUMNS in the HADB Setup and Operation Guide.

14

int

SQL_DATA_TYPE

The null value is always returned.

15

int

SQL_DATETIME_SUB

The null value is always returned.

16

int

CHAR_OCTET_LENGTH

Maximum length (in bytes) of a CHAR-type column

17

int

ORDINAL_POSITION

Column number (beginning at 1)

18

String

IS_NULLABLE

Value indicating whether the NULL value is permitted:

  • "NO": The null value cannot be used.

  • "YES": The null value might be permitted.

19

String

SCOPE_CATALOG

The method always returns a null character string.

20

String

SCOPE_SCHEMA

The method always returns a null character string.

21

String

SCOPE_TABLE

The method always returns a null character string.

22

short

SOURCE_DATA_TYPE

The null value is always returned.

23

String

IS_AUTOINCREMENT

Whether columns are incremented automatically:

  • NO: Columns are not incremented automatically.

    NO is always returned.

(5) Exceptions

If this Connection object is closed before this method is executed, the JDBC driver throws an SQLException.

(6) Notes

The value acquired as column information of the viewed table might differ between the following two methods:

  1. The DECIMAL_DIGITS value of the ResultSet object acquired by this method

  2. The value acquired by the getScale method of the ResultSetMetaData interface

The first of these methods acquires the scaling value that was in effect when the viewed table was defined. The second of these methods acquires the scaling value that was in effect when the viewed table was retrieved. These two values will differ if the value specified for the adb_sql_prep_dec_div_rs_prior operand in the server definition or the client definition when the table was defined differs from the value specified in this operand when the table was retrieved.