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

