![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is there a generic way, using ODBC/OLEDB/ADO.NET or another programmable database technology to determine foreign and primary key constraints in a table? |
|
I've tried using the ODBC API's SQLPrimaryKeys and SQLForeignKeys but they aren't always supported. |
#3
| |||
| |||
|
|
On 08.05.2007 19:28 Jason D. wrote: Is there a generic way, using ODBC/OLEDB/ADO.NET or another programmable database technology to determine foreign and primary key constraints in a table? The JDBC drivers do reveal this information as well (that would fall in the category "another programmable database technology") I've tried using the ODBC API's SQLPrimaryKeys and SQLForeignKeys but they aren't always supported. With JDBC this is up to the driver to support the calls or not (they are not required, as far as I know). I could image this is similar with the ODBC specs (I haven't used any of the mentioned interfaces) Look at the DatabaseMetaData class in the JDK documentation. Thomas |
#4
| |||
| |||
|
|
On May 9, 3:47 am, Thomas Kellerer <JUAXQOSZF... (AT) spammotel (DOT) com> wrote: On 08.05.2007 19:28 Jason D. wrote: Is there a generic way, using ODBC/OLEDB/ADO.NET or another programmable database technology to determine foreign and primary key constraints in a table? The JDBC drivers do reveal this information as well (that would fall in the category "another programmable database technology") I've tried using the ODBC API's SQLPrimaryKeys and SQLForeignKeys but they aren't always supported. With JDBC this is up to the driver to support the calls or not (they are not required, as far as I know). I could image this is similar with the ODBC specs (I haven't used any of the mentioned interfaces) Look at the DatabaseMetaData class in the JDK documentation. Thomas Thanks for the advice! It's a pain trying to use the ODBC API for it.....the calls are Level 2 and don't seem to be well supported. I'm having good luck with OLEDB using the OleDbSchemaGuid Class in .NET; though I might try doing it with .NET. Cheers, Jason |
#5
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |