Here you can find the source of getAllTables(Connection conn)
public static List<String> getAllTables(Connection conn) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; public class Main { private final static String SQL_SHOW_TABLES = "show tables"; public static List<String> getAllTables(Connection conn) throws SQLException { List<String> tableNameList = new ArrayList<String>(); Statement stmt = null;/* w w w .j av a 2 s. c o m*/ ResultSet rs = null; try { stmt = conn.createStatement(); rs = stmt.executeQuery(SQL_SHOW_TABLES); while (rs.next()) { tableNameList.add(rs.getString(1)); } return tableNameList; } finally { try { stmt.close(); } catch (SQLException e) { } } } }