Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

getting column names from JDBC and display it in JTree

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
greetings, could someone send me simple code on how to get the column names from table and display it in JTree format. I have two table maintenace and report, the node name would be the two table name and its child would be its corresponding column name and child for column would be its value or element....please someone help me for this...
thank you very much.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Supplying code is not what this site is for (see this). However we can get you started by suggesting you look as the class java.sql.ResultSetMetaData.
 
Ruel Soriano
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry for that, but i could not start what i'm doing coz i dont have any idea and can't of one, well i know how to use ResultSetMetaData and displaying the column but my big problem is how can i make a child of each...for example

Table [table_1] with column [column_1 column_2 column_3]
Table [table_2] with column [col1 col2 col3]

how can i make them to display in JTree like:

table_1
|
|-----------column_1
|-----------column_2
|-----------column_3
table_2
|
|------------col1
|------------col2
|------------col3

could someone give me an idea or better a sample code for this....
thanks in advance.....
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Better ask that question in the Swing / AWT / SWT / JFace forum.

Regards, Jan
 
author & internet detective
Posts: 41185
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agreed. Moving.
 
Ruel Soriano
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if i can get some code or extract a code just to be my guide......i know how to get the column name from and extract it to jtree but my problem is how if one of my column has a child, automatically it add on the last column name i created.
for example col_1, col_2, col_3 will be the node for root, what if i have a child for for each of the column, all of them will be in the last column like col_3.......

so please give a solution for this.....urgent.
 
reply
    Bookmark Topic Watch Topic
  • New Topic