Here you can find the source of getAllTables(Connection connection)
public static Set<String> getAllTables(Connection connection) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashSet; import java.util.Set; public class Main { public static Set<String> getAllTables(Connection connection) throws SQLException { Set<String> tables = new HashSet<String>(); DatabaseMetaData db = connection.getMetaData(); ResultSet rs = db.getTables(null, null, "%", new String[] { "TABLE" }); while (rs.next()) { tables.add(rs.getString(3)); }//from w ww. jav a2 s . c o m return tables; } }