"Paul Wallace" <[EMAIL PROTECTED]> wrote on 01/17/2005 12:04:13 AM:
> Hi, > How can I, if at all, acquire table relationships - in particular > one-to-may/many-to-one relationships? I have looked into the > DatabaseMetaData object (Java) , but have not as yet been able to > acquire the said relationship data. I post to this list as the ability > to pull such such information may be vendor specific? (am using MYSQL > 4.018). Can anyone tell me if MySQL is capable of serving up such > information - particularly using JDBC (JConnector)) > > thanks and regards > > Paul. I prefer to parse the results of a "SHOW CREATE TABLE..." query. It's rather trivial to detect which rows in the result of that statement are your FOREIGN KEYS. They not only indicate which table(s) is/are this table's parent(s) but also which columns participate in each relationship. This technique does not rely on any particular connection library as the functionality is provided by MySQL itself. Once the INFORMATION_SCHEMA views are made available as of v5.x+ we will have an alternative to using the "SHOW" family of statements to extract schema metadata. Shawn Green Database Administrator Unimin Corporation - Spruce Pine