File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes how to extract database metadata Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "how to extract database metadata " Watch "how to extract database metadata " New topic

how to extract database metadata

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
thank you for reading my post
is there any way that i can extract a database metadata into a .sql file or a posibility to extract the metadata and forward it to another database?
is there any library that make this job easier to do ?
it looks that directly using conn.getMetaData(); will be the hard way.

Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
Which database are you referring to? If you are in oracle 9i you can try DBMS_METADATA package (GET_XML and GET_DDL). Tools like TOAD supports this pretty good (with depedent objects w/o data).
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3749

Oracle is nice in that you can access any user table as a more abstract general table. What kind of meta data do you want though? Try to provide an example of what you are trying to do.

One option is to use a db generation tool that generates your JDBC code based on a one-time review of the database using JDBC getMetaData() calls. This could be time consuming per call but not so much if the code is generated infrequently.

[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: how to extract database metadata
It's not a secret anymore!