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
posted
0
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
posted
0
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
posted
0
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