Hello,
I am using the postgres driver for my Java code (JDK 1.2.2) which came
with the Postgres 7.0.3 tar file. I am trying get the name of a column
which is essentially the primary key in this table. Unfortunately, the
result set returned does not have any records(as shown below). This code
works fine on Oracle. I also tried jdbc7.0-1.2.jar but the same problem
occurs.
---- Code ----
public String getUniqueRowName() throws SQLException{
DatabaseMetaData dma = m_Connection.getMetaData();
ResultSet rs = dma.getIndexInfo("", "", "<table name>", true,
false);
if(rs == null){
return null;
}
rs.next(); ============================No records here
String sIndex = rs.getString("COLUMN_NAME");
return sIndex;
}
Any help is appreciated.
Thanks in advance for your time
Santosh Rau