Следующий код вызывает исключение SQLException: индекс столбца вне диапазона.
import java.sql.*;
public class ListingTablesTest {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Connection conn = null;
Statement stmt = null;
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost/library","java","");
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SHOW TABLES;");
ResultSetMetaData md = rs.getMetaData();
String columnName = "";
for(int i=0; i show tables;
+-------------------+
| Tables_in_library |
+-------------------+
| author |
+-------------------+
1 row in set (0.00 sec)
Подробнее здесь: https://stackoverflow.com/questions/362 ... lt-in-jdbc