• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL doubt

 
donepudi madhu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1821
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
donepudi,
Please adjust your displayed name to meet the JavaRanch Naming Policy. You can do so here.
 
Michael Matola
whippersnapper
Ranch Hand
Posts: 1821
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic