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 determine 1:1, 1:M etc. relationships using DatabaseMetaData

 
Joshua White
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getIndexInfo might be helpful too.
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic