Java SQL Table getTableNames(Connection conn)

Here you can find the source of getTableNames(Connection conn)

Description

get Table Names

License

Apache License

Declaration

public static String[] getTableNames(Connection conn) throws SQLException 

Method Source Code

//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]);
    }
}

Related

  1. getSensorsList( final Connection jdbcConnection, String tableName)
  2. getShapeText(Connection conn, String tableName)
  3. getTableFields(Connection con, String tableName)
  4. getTableList(Connection connection)
  5. getTableName(String sql)
  6. getTableNames(Connection conn)
  7. getTables(Connection conn)
  8. getTables(Connection connection)
  9. getTables(Connection connection)