This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to display primary keys from metadata

 
waleed atef abdel elazyz
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

note:
I want name acolumn(primary key)from the table



thanks,Best regards
[ December 14, 2004: Message edited by: waleed atef abdel elazyz ]
 
jeroen riezebeek
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic