File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes how to display primary keys from metadata Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "how to display primary keys from metadata" Watch "how to display primary keys from metadata" New topic

how to display primary keys from metadata

waleed atef abdel elazyz

Joined: Nov 01, 2004
Posts: 13
Dear all,
I have problem how to display and get primary keys from

databasemetadata .but already used method getprimarykeys()from

databasemetadata but the result dont understand.

I want name acolumn(primary key)from the table

thanks,Best regards
[ December 14, 2004: Message edited by: waleed atef abdel elazyz ]
jeroen riezebeek

Joined: Nov 26, 2002
Posts: 9
to get the primary keys directly from the databasemetadata is not possible.
You can get the primary key with the method getPrimaryKeys(String catalog, String schema, String table).
This method returns a resultset witht primary keys.
Since there isn't a primary key object will the resultset exists of primary key names.
For more information see javadoc about the DatabaseMateData object.
I agree. Here's the link:
subject: how to display primary keys from metadata
It's not a secret anymore!