There is a connection to the database. The scheme is unknown in advance. How to find out which tables are in the database?

OracleDataSource ods = new OracleDataSource(); // Здесь остальные параметры подключения // ... Connection conn = ods.getConnection(); 

    2 answers 2

    Run the query "select * from ALL_TABLES" and comprehend the results

    • 2
      Works. Statement stmt = conn.createStatement (); ResultSet rs = stmt.executeQuery ("select table_name from all_tables"); while ( ()) {System.out.println (rs.getString (1)); } rs.close (); stmt.close (); - angry
    • four
      Such experiments are conveniently carried out in Oracle sqldeveloper or simply from sqlpus. - avp

    Table and name of the scheme:

    select table_name, tablespace_name from ALL_TABLES;

    Or you can display all the required fields. You can learn them:

    describe all_tables;

    and what is written in them can be understood by the name of these fields.