Re: JDBC DatabaseMetaData getIndexInfo() returning null values



Adam,
I see the same behavior as reported below and found that the key data point
to notice is the TYPE value returned in the results. The JDBC spec defines
the possible types as follows:


public static final short
tableIndexClustered
1

public static final short
tableIndexHashed
2

public static final short
tableIndexOther
3

public static final short
tableIndexStatistic
0


Based on this detail, the data returned in the first row is purely
statistical(TYPE=0). The spec says this about statistics:

Indicates that this column contains table statistics that are returned in
conjunction with a table's index descriptions.

The second row of data is of type tableIndexOther(TYPE=3) which is defined
as:

Indicates that this table index is not a clustered index, a hashed index,
or table statistics; it is something other than these.

So it looks like the driver is getting the proper data from the DB and
returning the correct metadata to the JDBC app. SQL Server has a system SP
called sp_autostats which when run on the table in the repro steps above
returns 'ON' for the automatic UPDATE STATISTICS setting on this table.
This procedure can be run to turn automatic statistics recording off, but
you should consult MS documentation or support to learn the implications of
such an action before proceeding.

Sue Purkis
DataDirect Technologies




.


Loading