Here you can find the source of getTableNames(Connection conn)
public static String[] getTableNames(Connection conn) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class Main { public static String[] getTableNames(Connection conn) throws SQLException { List<String> lTableName = new ArrayList<String>(); ResultSet rsTable = conn.getMetaData().getTables("", "", "", new String[] { "TABLE" }); while (rsTable.next()) { lTableName.add(rsTable.getString(3)); }//w ww .j a v a 2 s . c o m return lTableName.toArray(new String[0]); } }