wood burning stoves 2.0*
The moose likes JDBC and the fly likes Get table names from a database in access  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Get table names from a database in access  " Watch "Get table names from a database in access  " New topic

Get table names from a database in access

Aditya Torvi

Joined: Aug 12, 2004
Posts: 3
The following code works with Oracle, Sybase, MySQL.

public void listTables()
Connection connection = getConnection();
String catalogName, /* this can be null for all catalogs */
schemaName, /* this can be null for all schemas */
tableType = "TABLE"; /* this can be null for "any" type */

if ((connection != null) && (tableType != null)) {
DatabaseMetaData dmd = connection.getMetaData();
ResultSet rs;

rs = dmd.getTables(catalogName, schemaName, null, new String[]{tableType });

while (rs.next()) {
System.out.println("Table name = " +

But gives this exception for Access-
[Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented

Any suggestions?
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Your driver doesn't implement the getTables method. Change your driver. From the java.sql.DatabaseMetaData JavaDoc:

Different relational DBMSs often support different features, implement features in different ways, and use different data types

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
wood burning stoves
subject: Get table names from a database in access
Similar Threads
How to get list of tables in MS access database into my java program
jdbc and ms access with stored query
STORING Resultset in String variable
DatabaseMetaData API
Getting Table Name