JDBC Primary Index

Connectivity
Enthusiast

JDBC Primary Index

I'm attempting to write a Java application which creates test data in a table specified by the user. But my app needs to know which columns need to be unique, and which make up the index and/or primary index of the table. Since the Teradata JDBC driver does not support getIndexInfo, is there another way I can obtain this information?
4 REPLIES
Enthusiast

Re: JDBC Primary Index

Are you sure getIndexInfo() didn't work for you ?

I recall my development team using something like that in the past to retrieve this information.

Another way is to select from dbc.indices (make use of the uniqueflag column)
Enthusiast

Re: JDBC Primary Index

Well the samples that came with the driver included a file showing how to get index information, leading me to believe that it worked. But when I tried using getIndexInfo(), INDEX_NAME in the ResultSet was always null. I know the ResultSet was set correctly because TABLE_NAME and some other data was present, but the actual name of the index column(s) were not there.

Maybe I'm having nomenclature issues...the Index that getIndexInfo() is talking about should be Teradata's Index, right...like the primary index? Or is it some other relational db feature with the same name?
Enthusiast

Re: JDBC Primary Index

INDEX_NAME would be NULL if the index wasn't given a name during the time of creation (which is purely optional in TD) ... (you can check the table DDL via the show table tablename) command to see if those indexes had a name or not.
Enthusiast

Re: JDBC Primary Index

Ok, thanks.

And I just looked into using dbc.indices, and that will work great for what I need. Thanks a lot!