Here you can find the source of tableExists(Statement stmt, String name)
public static boolean tableExists(Statement stmt, String name) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.*; public class Main { public static boolean tableExists(Statement stmt, String name) throws SQLException { ResultSet rs = stmt.executeQuery("SELECT count(*) FROM sqlite_master WHERE type == 'table' and name == '" + name.replace("'", "''") + "';"); rs.next();/*from w w w. jav a2 s . c om*/ return (0 == rs.getInt("count(*)")) ? (false) : (true); /* return stmt.executeQuery( "SELECT\n" + " CASE\n" + " WHEN EXISTS(SELECT 1 FROM sqlite_master WHERE type == 'table' and name == '" + name.replace("'", "''") + "')\n" + " THEN 1\n" + " ELSE 0\n" + " END AS 'exists'\n" + ";" ).getBoolean("exists"); */ } }