Here you can find the source of tableExists(Connection connection, String tableName)
public static boolean tableExists(Connection connection, String tableName) throws SQLException
//package com.java2s; /*/* w w w .ja v a2 s . co m*/ * Copyright (c) Mirth Corporation. All rights reserved. * * http://www.mirthcorp.com * * The software in this package is published under the terms of the MPL license a copy of which has * been included with this distribution in the LICENSE.txt file. */ import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; public class Main { public static boolean tableExists(Connection connection, String tableName) throws SQLException { ResultSet resultSet = null; try { DatabaseMetaData metaData = connection.getMetaData(); resultSet = metaData.getTables(null, null, tableName, null); if (resultSet.next()) { return true; } resultSet = metaData.getTables(null, null, tableName.toUpperCase(), null); return resultSet.next(); } finally { resultSet.close(); } } }