aspose file tools*
The moose likes JDBC and the fly likes Accessing table names in MSAccess Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Accessing table names in MSAccess" Watch "Accessing table names in MSAccess" New topic
Author

Accessing table names in MSAccess

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
HI
I want to retrieve the names of the available tables in MSAccess.
I know how to do this in SQL Server & Oracle .
Can any one please tell me the equivalent command in MSAccess?
Thanks in advance
Surya
Amit Manurkar
Greenhorn

Joined: Apr 03, 2003
Posts: 11
Hey did u find any solution for your problem ? If yes can you share it with me ?


Amit Manurkar
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1815
Check out the DatabaseMetaData class. It should provide you with what you need.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
As already posted check out the databasemetadata API for more information. You can also search this forum.
The following should give you the table names and number of tables.
DatabaseMetaData myMT = conn.getMetaData(); //Used to retrieve information about the database
String[] myTables = {"TABLE"};
ResultSet tables = myMT.getTables(null,
null, "%", myTables);
String tableName = null;
int tableCnt = 0;
while (tables.next())
{
tableName = tables.getString("TABLE_NAME");
++tableCnt;
System.out.println("Table " + tableCnt + ": " + tableName);
}
System.out.println("Number of tables is : " + tableCnt);


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing table names in MSAccess
 
Similar Threads
JDBC
JDBC
Stored procedures in MSAcess
jdbc advanced
free type4 driver for msaccess