| Author |
jtree and database
|
jb er
Greenhorn
Joined: May 02, 2003
Posts: 3
|
|
Hi, I have not used jtree before and I am trying to make one which represents the database. I know that the root will be the database name. children will be tablenames and grandchildren will be column or field names. I also understood how tree is created etc... My question is how do I get the colum/field names? Is there a method like say getcolumnname or so.. Same problem with tablenames. Are there any examples i could take a look. All the examples I saw deal with file explorer. Help, J
|
 |
Avi Abrami
Ranch Hand
Joined: Oct 11, 2000
Posts: 1112
|
|
Hi J,
how do I get the colum/field names?
Pardon me, but is the "DatabaseMetaData" interface not suitable? http://java.sun.com/j2se/1.4.1/docs/api/java/sql/DatabaseMetaData.html Hope it helps. Good Luck, Avi.
|
 |
jb er
Greenhorn
Joined: May 02, 2003
Posts: 3
|
|
Thanks, I know how to get the columns for each table, using ResultMetaData. But am still confused on how to get just the table names. I checked your link, but am not so good at DB. So am confused as to which one to use... to get just the tableNames. Thanks, J
|
 |
Naveen Asha
Greenhorn
Joined: Mar 30, 2003
Posts: 12
|
|
There is method in ResultSetMetaData to get table name. ResultSetMetaData.getCatalogName(int)
|
 |
Naveen Asha
Greenhorn
Joined: Mar 30, 2003
Posts: 12
|
|
|
Sorry, it is getTableName(int)
|
 |
 |
|
|
subject: jtree and database
|
|
|