Почему я не могу проанализировать результат SHOW TABLES в JDBC?JAVA

Программисты JAVA общаются здесь
Anonymous
Почему я не могу проанализировать результат SHOW TABLES в JDBC?

Сообщение Anonymous »

Следующий код вызывает исключение 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

Вернуться в «JAVA»