File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes SQL doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL doubt" Watch "SQL doubt" New topic
Author

SQL doubt

donepudi madhu
Greenhorn

Joined: Sep 25, 2002
Posts: 11
Can we get the list of table names in a particular database(MS Access)? ie; I need a query which is similar to select * from dual; which works in Oracle
Paul Bergin
Greenhorn

Joined: Sep 27, 2002
Posts: 2
If you want to get a slist of table names back to Java this is how it can be done
//open connection to database
con = DriverManager.getConnection(url, userName, password);
//get db meta data
DatabaseMetaData db = con.getMetaData();
//get ResultSet of table names
ResultSet tablesDbMetaData = db.getTables(null,dsn,"%",types);
//loop through result set and get print table names
while(tablesDbMetaData.next())
{
tableName = tablesDbMetaData.getString("TABLE_NAME");
System.out.println("tableName = "+tableName);
}
Michael Matola
whippersnapper
Ranch Hand

Joined: Mar 25, 2001
Posts: 1740
    
    2
donepudi,
Please adjust your displayed name to meet the JavaRanch Naming Policy. You can do so here.
Michael Matola
whippersnapper
Ranch Hand

Joined: Mar 25, 2001
Posts: 1740
    
    2
Originally posted by donepudi:
Can we get the list of table names in a particular database(MS Access)? ie; I need a query which is similar to select * from dual; which works in Oracle

select * from dual
gives you a list of table names in Oracle?
donepudi madhu
Greenhorn

Joined: Sep 25, 2002
Posts: 11
Originally posted by Michael Matola:

select * from dual
gives you a list of table names in Oracle?

Sorry sir, it was told by my friend when I posed this query.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL doubt
 
Similar Threads
Jboss Experts - Bangalore
Websphere docs
Ant Build Successful but neither jar file nor build folder created ?
Parking the car....
how can i insert a null value in a table