Here you can find the source of hasTable(String TableName, Connection conn)
public static boolean hasTable(String TableName, Connection conn) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.*; public class Main { public static boolean hasTable(String TableName, Connection conn) throws SQLException { DatabaseMetaData md = conn.getMetaData(); String[] Types = { "TABLE", "VIEW" }; ResultSet rs = md.getTables(null, null, TableName, null); boolean ret = rs.next(); rs.close();//from ww w. j a v a 2s.co m if (ret) return (ret); rs = md.getTables(null, null, TableName.toUpperCase(), null); ret = rs.next(); rs.close(); return (ret); } }