Here you can find the source of getTableName(String sql)
public static String getTableName(String sql) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.SQLException; public class Main { private static final String FROM_KEY = " from "; public static String getTableName(String sql) throws SQLException { String tableName = ""; int pos = sql.indexOf(FROM_KEY); if (pos >= 0) { String tab = sql.substring(pos + FROM_KEY.length(), sql.length()); int pp = tab.indexOf(' '); if (pp >= 0) { tableName = tab.substring(0, pp); } else { tableName = tab;//from w w w . ja v a 2 s . c om } } return tableName; } }