aspose file tools*
The moose likes JDBC and the fly likes How to determine 1:1, 1:M etc. relationships using DatabaseMetaData Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to determine 1:1, 1:M etc. relationships using DatabaseMetaData" Watch "How to determine 1:1, 1:M etc. relationships using DatabaseMetaData" New topic
Author

How to determine 1:1, 1:M etc. relationships using DatabaseMetaData

Joshua White
Ranch Hand

Joined: Jun 04, 2001
Posts: 97
Hello all,
How can you determine the relationships between tables using DatabaseMetaData?
Looking at some of the methods in the api, it looks like you can only determind pk/fk relationships. Suggesions?
Regards,
Joshua
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

getIndexInfo might be helpful too.


http://home.arcor.de/hirnstrom/bewerbung
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121

Joshua,
Pardon my ignorance, but if we are talking about a relational database management system (RDBMS), then what other inter-table relationships are there besides foreign-key relationships?
As far as I know, there are only foreign-key relationships, for which the DatabaseMetaData interface has the methods "getExportedKeys()" and "getImportedKeys()".
Good Luck,
Avi.
[ May 11, 2004: Message edited by: Avi Abrami ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to determine 1:1, 1:M etc. relationships using DatabaseMetaData
 
Similar Threads
DatabaseMetaData
Database Metadata
Find out if a table exists
Image size
how to get Database name from connection object