Here you can find the source of getTables(File database)
static public ArrayList<String> getTables(File database) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
//package com.java2s; /**/*from w w w . ja v a2s . c o m*/ * OWASP GoatDroid Project * * This file is part of the Open Web Application Security Project (OWASP) * GoatDroid project. For details, please see * https://www.owasp.org/index.php/Projects/OWASP_GoatDroid_Project * * Copyright (c) 2012 - The OWASP Foundation * * GoatDroid is published by OWASP under the GPLv3 license. You should read and accept the * LICENSE before you use, modify, and/or redistribute this software. * * @author Jack Mannino (Jack.Mannino@owasp.org https://www.owasp.org/index.php/User:Jack_Mannino) * @created 2012 */ import java.io.File; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; public class Main { static public ArrayList<String> getTables(File database) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { String DB_CONNECTION_STRING = "jdbc:derby:" + database; Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); Connection conn = (Connection) DriverManager.getConnection(DB_CONNECTION_STRING); DatabaseMetaData dbmd = conn.getMetaData(); ResultSet rs = dbmd.getTables(null, null, null, null); ArrayList<String> tables = new ArrayList<String>(); while (rs.next()) { /* * We only want application tables Don't really care about the rest * of the schema */ if (rs.getString("TABLE_SCHEM").equals("APP")) tables.add(rs.getString("TABLE_NAME")); } conn.close(); return tables; } }