import java.io.*; import java.sql.*; import java.util.Properties; public class MySQL { public static void main(String[] args) { Connection conn = null; Statement stmt = null; try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1/test?user=root&password="); stmt = conn.createStatement(); stmt.execute("Use tbl"); String sql = "show table status;"; ResultSet rs = stmt.executeQuery(sql); while ( rs.next() ) for (int i=1; i<19; i++) { System.out.println(rs.getMetaData().getColumnLabel(i) + ": " + rs.getString(i)); } } catch ( Exception e ) { System.out.println("Error: " + e.getMessage()); } finally { try { if ( conn != null ) conn.close(); } catch (SQLException e) {} try { if ( stmt != null ) stmt.close(); } catch (SQLException e) {} } } }