This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes get primar key and foreign keys from table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Reply locked New topic

get primar key and foreign keys from table

waleed atef abdel elazyz

Joined: Nov 01, 2004
Posts: 13
Dear all,
I have aproblem how to get primary key and foreign key from table

and relation between tables.

please explain code
thanks and best regards
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1141

Pardon me if I am stating the obvious, but I believe the java.sql.DatabaseMetaData interface is what you need.

Good Luck,
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63542

waleed, please do not post the same question more than once.

forum bartender

[Asking smart questions] [About Bear] [Books by Bear]
It is sorta covered in the JavaRanch Style Guide.
subject: get primar key and foreign keys from table
It's not a secret anymore!