views:

33

answers:

3

I need to get the db table informations like columns detail, pk/uk/check/fk constraints etc. for popular databases (Oracle, MySql, MSSql , DB2 etc). I know each database provide some way or other to retreive the schema information. Does somebody know the generic way to collect the schema information from different databases (Some sort of API which reads different database information schema and create a generic information schema).

A: 

Unfortunately there is no unified API. This aspect of databases has never been standardized and each vendor provides different means to accessing this data.

You will have to implement this differently per each database.

Oded
+1  A: 

Several major databases (including those you list) implement SQL's INFORMATION_SCHEMA schema, which should provide the information you need. I don't know how closely each vendor tracks this aspect of the standard.

Marcelo Cantos
+1  A: 

It seems that SQL-92 defines an information schema. Microsoft SQL Server, Sybase ASE, Oracle seem to have it.

pascal