Here you can find the source of tableExists(String tableName, Connection conn)
public static boolean tableExists(String tableName, Connection conn) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; public class Main { public static boolean tableExists(String tableName, Connection conn) throws SQLException { DatabaseMetaData dbmd = conn.getMetaData(); ResultSet rs = dbmd.getTables(null, null, null, null); while (rs.next()) { if (rs.getString("TABLE_NAME").equalsIgnoreCase(tableName)) { return true; }/*from w w w.jav a2s.c om*/ } return false; } }