After I getMetaData() into a ResultSet, I would like to obtain the primary keys of a table. How do I find the column names of the ResultSet so I can ask for the column containing the Primary Key? I think I can find that in the method list that pops up, but then can I get ResultSets within ResultSets so that I would get the table names and then the primary keys for each table name? Is that possible?

This is part of my code:

// retrieve database names ResultSet
resultSet = dbMeta.getCatalogs();
String dbName;
String tableName;
while ( {
dbName = resultSet.getString("TABLE_CAT");
System.out.println( "dbName = " + dbName);

// retrieve table names ResultSet
resultSet = dbMeta.getTables(null,null,"%",null);
while ( {
tableName = resultSet.getString("TABLE_NAME");
System.out.println( "tableName = " + tableName);

// retrieve Primary Keys ResultSet
resultSet = dbMeta.getPrimaryKey("accounting", "betty80906","iceCream");
while ( {
primaryKey = resultSet.getString(" not sure what goes here yet" );
System.out.println( "Primary Key= " + primaryKey );