All Forums Connectivity
newerakb 14 posts Joined 12/07
19 Feb 2008
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?

joedsilva 505 posts Joined 07/05
19 Feb 2008

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)

newerakb 14 posts Joined 12/07
20 Feb 2008

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?

joedsilva 505 posts Joined 07/05
20 Feb 2008

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.

newerakb 14 posts Joined 12/07
20 Feb 2008

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

You must sign in to leave a comment.