Here you can find the source of tableExists(Connection conn, String name)
public static boolean tableExists(Connection conn, String name) throws SQLException
//package com.java2s; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; public class Main { /**//from w w w . j a v a 2 s. c o m * Returns true if the table with the specified name exists, false if it does * not. <em>Note:</em> the table name is case sensitive. */ public static boolean tableExists(Connection conn, String name) throws SQLException { boolean matched = false; ResultSet rs = conn.getMetaData().getTables("", "", name, null); while (rs.next()) { String tname = rs.getString("TABLE_NAME"); if (name.equals(tname)) { matched = true; } } return matched; } }