Java SQL Table Exist tableExists(Connection con, String table)

Here you can find the source of tableExists(Connection con, String table)

Description

table Exists

License

Apache License

Declaration

private static boolean tableExists(Connection con, String table)
            throws IOException, SQLException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;

import java.sql.Connection;

import java.sql.SQLException;

public class Main {
    private static boolean tableExists(Connection con, String table)
            throws IOException, SQLException {
        try {// w w w.ja v  a2  s  .  co  m
            con.createStatement().execute("select * from " + table);
            return true;
        } catch (SQLException e) {
            return false;
        }
    }
}

Related

  1. tableExist(Statement stmt, String tablename)
  2. tableExists(Connection con, String tableName)
  3. tableExists(Connection conn, String name)
  4. tableExists(Connection conn, String tableName)
  5. tableExists(java.sql.Connection conn, java.lang.String table)