File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jtree and database

 
jb er
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1141
1
Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is method in ResultSetMetaData to get table name.
ResultSetMetaData.getCatalogName(int)
 
Naveen Asha
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, it is getTableName(int)
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic