aspose file tools
The moose likes JDBC and the fly likes fetching oracle table names into java program Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "fetching oracle table names into java program" Watch "fetching oracle table names into java program" New topic
Author

fetching oracle table names into java program

srinivas k
Greenhorn

Joined: Jan 31, 2003
Posts: 17
Hi all,
Could any one pl: let me know as to how we could fetch the table names from oracle database for a perticular user, a code snippet regarding this is very much appreciated
Thanks
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Try this. I don't know whether your database will display all tables or just those which are visible to the active user.

[ August 19, 2003: Message edited by: Lasse Koskela ]

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8876

Why not just use the query
select table_name from all_tables where owner='SCOTT';

You can replace the owner by appropriate user name.


Groovy
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
True. That would work if you're not afraid of being slightly locked into Oracle-speficic SQL and if the user has the grant to do a SELECT on ALL_TABLES.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8876

You can use use user_tables in place of all_tables.
Yes, it is Oracle specific.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: fetching oracle table names into java program
 
Similar Threads
Database Tables
SQL doubt
error invalid column name
sid in jdbc oracle connection string
column name