Re: Code request; Code to reveal a DB schema

2001-12-21 Thread August Detlefsen

What DB are you using? 

For Oracle, anyway: 

SELECT table_name FROM all_tables;
SELECT trigger_name FROM all_triggers;
SELECT view_name FROM all_views;
...

-Will give you the lists of all tables, triggers, and views
respectively in your DB. 

For the structure of each table, use:

DESC tablename

or 

SELECT column_name, data_type 
FROM user_tab_columns
WHERE table_name = 'tablename';

You can also use DESC on the all_whatever views to see what other
columns are available for each one. 




--- Mike Kelley [EMAIL PROTECTED] wrote:
 I'm looking for some dynamic code that will reveal all libraries,
 files,
 fields in a DB Does anyone have an example or can you point me in the
 right
 direction?
 
 
 I know I stumbled across something when installing TC but I can't
 find it
 now 
 
 TIA 
 
 Mike
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 


__
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Code request; Code to reveal a DB schema

2001-12-19 Thread Jim Cheesman

At 06:04 AM 19/12/01, you wrote:
I'm looking for some dynamic code that will reveal all libraries, files,
fields in a DB Does anyone have an example or can you point me in the right
direction?


java.sql.DatabaseMetaData is your friend!





--

   *   Jim Cheesman   *
 Trabajo: 
[EMAIL PROTECTED] - (34)(91) 724 9200 x 2360
  I'm still not sure 
if I understand ambiguity.



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Code request; Code to reveal a DB schema

2001-12-19 Thread Justin Rowles

 I'm looking for some dynamic code that will reveal all 
 libraries, files,
 fields in a DB Does anyone have an example or can you point 
 me in the right
 direction?

*Totally* DB specific.  For Oracle try searching http://technet.oracle.com;
for anything else try asking on a database list? ;-)

J.
-- 
You're only jealous cos the little penguins are talking to me. 



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Code request; Code to reveal a DB schema

2001-12-19 Thread Justin Rowles

 I'm looking for some dynamic code that will reveal all 
 libraries, files, fields in a DB Does anyone have an 
 example or can you point me in the right direction?
 
 java.sql.DatabaseMetaData is your friend!

Wow!  I didn't know that, ta!

Apols for the previous wrong answer then.

J.
-- 
You're only jealous cos the little penguins are talking to me. 



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Code request; Code to reveal a DB schema

2001-12-19 Thread James Chuang

For sybase, it used to be that you have to run a SQL script to load some
system procs before the MetaData stuff would work.  Their jConnect driver
used to document this pretty well.

jchuang

- Original Message -
From: Ralph Einfeldt [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, December 19, 2001 2:00 AM
Subject: AW: Code request; Code to reveal a DB schema


At least in some versions of sybase
DatabaseMetaData.getColumns() doesn't
work.

We use the following as a workaround:

select * from 'tablename' where 1  1

and use ResultSetMetaData to find the
columns. Dirty trick, but works with
any database we tested (Adabas D,
Oracle 8i, Sybase ASA, Interbase,
Cloudscape, Instant DB, Postgres,
MS SQL)

 -Ursprüngliche Nachricht-
 Von: Jim Cheesman [mailto:[EMAIL PROTECTED]]
 Gesendet: Mittwoch, 19. Dezember 2001 09:42
 An: Tomcat Users List
 Betreff: Re: Code request; Code to reveal a DB schema


 At 06:04 AM 19/12/01, you wrote:
 I'm looking for some dynamic code that will reveal all
 libraries, files,
 fields in a DB Does anyone have an example or can you point
 me in the right
 direction?


 java.sql.DatabaseMetaData is your friend!





 --

*   Jim Cheesman   *
  Trabajo:
 [EMAIL PROTECTED] - (34)(91) 724 9200 x 2360
   I'm still not sure
 if I understand ambiguity.



 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Code request; Code to reveal a DB schema

2001-12-19 Thread Igor Fedulov

 *Totally* DB specific.  For Oracle try searching
http://technet.oracle.com;
 for anything else try asking on a database list? ;-)

For code examples I would poke around Netbeans code they have some cool
functionality in Runtime tab of the explorer, i.e. database browser of some
kind. Try to download the sources from netbeans.org and poke around. Other
then that I would just research java.sql.DatabaseMetaData class, it will do
it for you (assuming that driver implements all supporting interfaces
correctly).

Igor


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]