getting data from MySQL in Jtable

Hi,

Does anyone know how to get "table names" and their "field names" from MySQL in the Jtable?

I've done the coding for retreiveing table names and their attributes from my database , the problem is i don't know how to put them in Jtable! Here is the part of code which returns theTable names and their field names:

Statement tableStatement = conn.createStatement();

Statement fieldStatement = conn.createStatement();

ResultSet fields = null;

ResultSet tables = tableStatement.executeQuery("show tables");

while(tables.next())

{

String tableName = tables.getString(1);

System.out.println("table name::" + tableName);

fields = fieldStatement.executeQuery("describe " + tableName);

while(fields.next())

{

String fieldName = fields.getString(1);

System.out.println("\tfieldName::" + fieldName);

}

I'd be very grateful if you could help me with doing this.

Elham

[977 byte] By [Eliiia] at [2007-11-26 21:14:04]
# 1
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#dataWas it helpful?
benubacha at 2007-7-10 2:52:24 > top of Java-index,Java Essentials,Java Programming...