This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 1746
    
    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: 1746
    
    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