This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.classpath | Wed May 14 16:26:51 -0700 2008 | [scharris] |
| |
.gitignore | Thu May 15 14:53:23 -0700 2008 | [scharris] |
| |
.project | Wed May 14 16:26:51 -0700 2008 | [scharris] |
| |
COPYING | Wed May 14 16:26:51 -0700 2008 | [scharris] |
| |
README | Thu May 29 11:47:27 -0700 2008 | [scharris] |
| |
build.xml | Wed Jul 23 11:20:10 -0700 2008 | [scharris] |
| |
com/ | Wed Jul 23 10:29:32 -0700 2008 | [scharris] |
| |
db-metadata.jar | Wed Jul 23 11:20:10 -0700 2008 | [scharris] |
| |
entrypoints.xml | Wed May 14 16:26:51 -0700 2008 | [scharris] |
| |
module.xml | Wed Jul 23 12:26:13 -0700 2008 | [scharris] |
| |
resources/ | Wed Jul 23 11:29:40 -0700 2008 | [scharris] |
README
db-metadata: provides a simple java library and NetKernel module for fetching database metadata information.
As a Java Library:
==================
The db-metadata.jar archive may be used as a simple Java library for fetching metadata information for a
database schema. Use class com.github.scharris.db_metadata.DBMetaData to fetch metadata information about
tables, views, fields and foreign key links in a given schema.
As a NetKernel module:
======================
The db-metadata.jar is also a valid self-contained NetKernel module which handles active:db-metadata
uri requests.
The metadata is returned in the following form:
<database-metadata schema="..." identifiers-case-sensitivity="...">
<relations>
<relation type="..." id="..." name="..." schema="...">
<field id="..." name="...">
<type>
<database-type/>
<jdbc-type-code/>
<jdbc-type-text/>
[<max-chars/>]
[<precision/>
<scale/
<radix/>]
</type>
<nullable/>
[<primary-key-part/>]
</field>
...
</relation>
...
</relations>
<foreign-key-links>
<link>
<referencing-relation name="..." schema="..."/>
<referenced-relation name="..." schema="..."/>
<match fk-field="..." pk-field="..."/>
...
</link>
...
</foreign-key-links>
</database-metadata>
Arguments for active:db-metadata requests in NetKernel
------------------------------------------------------
+schema: either a direct schema name (not containing a ':'), or a uri which when sourced should return the
schema name. To enter a schema name containing a ':', use the "data:" scheme, e.g. "data:text/plain,ACCOUNTING".
+views: whether to include views.
Valid values are y/yes/n/no/t/true/f/false or else a uri yielding one of these values.
+tables: whether to include tables.
Valid values are as described for the views argument.
+fields: whether to include field metadata within table and view elements.
Valid values are as described for the views argument.
+fks: whether to include metadata describing foreign key links in the schema.
Valid values are as described for the views argument.
Example uri:
active:db-metadata+schema@myschema+views@ffcpl:/etc/include-views+fields@y+fks@y
NetKernel Module Installation:
------------------------------
1) Copy the included db-metadata.jar file into your {NetKernel-Home}/modules directory,
or wherever else you'd like to keep it.
2) Register the module's location with netkernel by entering its location in
{NetKernel-Home}/etc/deployedModules.xml, e.g. by adding a line like:
<module>modules/db-metadata.jar</module>
3) import the module into your own client modules:
<import><uri>urn:com:github:scharris:db-metadata</uri></import>
Requests, suggestions and comments are welcome. Send to steveOfAR at domain gmail.com.
As a Standalone Program
=======================
The DBMetaData class includes a main method which can write database metadata as xml to an output file.
To do this, first create a properties file describing the database connnection information, with properties:
jdbc-connect-url, jdbc-driver-class, user, and password.
For example,
#file connection.props
jdbc-connect-url=jdbc:oracle:thin:@myhost.mydomain.org:1528:mysid
jdbc-driver-class=oracle.jdbc.OracleDriver
user=mydbuser
password=mypassword
Then invoke the command like this:
java -cp db-metadata.jar:ojdbc14.jar com.github.scharris.db_metadata.DBMetaData myschema connection.props myschema.xml
which would write the database metadata for schema myschema to file myschema.xml.




