DatabaseMetaData failing to return primary keys
Posted on 2006-03-22
I have existing db-metadata code that just stopped working. This is it:
DatabaseMetaData dbmd = conn.getMetaData();
tableName = "FS_VENDOR_ACCT";
ResultSet rs = dbmd.getPrimaryKeys(null, null, tableName);
String keyName = rs.getString("COLUMN_NAME");
System.out.println("Is a key:" + keyName);
I know for sure that:
The connection (conn) works (it correctly gets TABLE metadata next)
The correct database is being accessed (see above..)
The table exists (I have tried prepending the database name and owner name to the table name, with no luck)
The table has a primary key (consisting of three fields)
Two big things have changed since this last worked:
1. I switched to Eclipse (from JBuilder)
2. I put this class in a (non-default) package.
What returns is nothing: It doesn't blow up, it just returns an empty result set. To test, I tried putting garbage in the tablename, and that return the same empty result set.
HELP! Any guesses?