Java JDBC Database Metadata getAllTables(Connection connection)

Here you can find the source of getAllTables(Connection connection)

Description

get All Tables

License

Open Source License

Declaration

public static ResultSet getAllTables(Connection connection) throws SQLException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015 SAP and others./*w w  w.j a  v a  2 s.  c  om*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * SAP - initial API and implementation
 *******************************************************************************/

import java.sql.Connection;
import java.sql.DatabaseMetaData;

import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
    private static final String TABLE_NAME_PATTERN_ALL = "%";

    public static ResultSet getAllTables(Connection connection) throws SQLException {
        DatabaseMetaData meta = connection.getMetaData();
        ResultSet tableNames = meta.getTables(null, null, TABLE_NAME_PATTERN_ALL, null);
        return tableNames;
    }
}

Related

  1. adjustIdentifierCase(String identifier, Connection conn)
  2. createHsqlPlSchemaIfNecessary(Connection con)
  3. getAllTables(Connection connection)
  4. getCatalogs(Connection c)
  5. getColumnDefaultValue(DatabaseMetaData metaData, String tableName, String columnName)
  6. getColumnNames(Connection connection, String tableName)