> Mark Matthews wrote: > > > Alan Hodgkinson wrote: > > > > I would like to extract the meta data describing foreign key > > relationships using ODBC (actually in Java using JDBC). > > > > My current version of mySQl 3.23.49 does not seem to support > > it. That is the methods DatabaseMetaData.getImportedKeys(...) > > and DatabaseMetaData.getExportedKeys(..) return empty sets > > on tables which have foreign keys defined on them. > > [snip] > > I don't want to do an upgrade unless I'm certain that I will > > get the feature. > > First, you need to use InnoDB tables to be able to extract foreign key > information.
Ah.. thank you. I had though that native tables in the newer MySQL version, stored and we able re-display, the foreign key definitions, but that they didn't actually enforce them as constraints. This means I MUST have 'type=innodb' in my create statements, right? That's a small inconvenience, but acceptable. > Second, are you trying to use the JDBC:ODBC bridge (not recommended at > all), or the Type IV JDBC driver (MySQL Connector/J) to do this? Type IV. I've been using: mm.mysql-2.0.14, which I beleive is the old version of Connector/J. You probably know more about that than me :) > Connector/J supports DatabaseMetaData.getImported/ExportedKeys(). Cool! I'll upgrade. THE MOST IMPORTANT QUESTION --------------------------- Do you know which version of _MySQL_ supports the foreign key info? Is it only in version 4.x or does the latest 3.32.x have it too? The documentation and change log are relatively vague about it. Why am I doing this? -------------------- My goal is to be able to extract meta-data out from an existing database and then generate a Turbine/Torque compliant XML configuration file. I must have the foreign key info. I will be performing the foreign key meta-data extraction as a development step (as opposed to in production with lots of data). The DB could in principal be empty. Performance is NOT an issue. ...and yeah, I'm willing to share my code (I am planning to give it to the Torque gang). Many thanks, Alan. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php