Tags: access, bridge, connectivity, database, getprimarykeys, isresultset, java, jdbc, postings, primarykeys, solution, trs, usingodbc, working

getPrimaryKeys not working with MS Access

On Java Studio » Java Database Connectivity (JDBC)

564 words with 1 Comments; publish: Fri, 21 Sep 2007 22:20:00 GMT; (15062.50, « »)

Just a solution how to get the PrimaryKeys on MS Access when using

ODBC Bridge. There are 20 postings here but no solution. Here it is:

ResultSet trs = connection.getMetaData().getIndexInfo(null, null, table, false, true);

while (trs.next()) {

String tmp = trs.getString(9);

String primaryKey = trs.getString(6);

if (tmp != null && primaryKey.equals("PrimaryKey")) {

System.out.println("Primary Key found: "+tmp+", "+primaryKey);

}

}

trs.close();

All Comments

Leave a comment...

  • 1 Comments
    • Postings with answers are better ...
      #1; Mon, 16 Jul 2007 02:41:00 GMT