This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes how to display the resultset into the JTabel ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "how to display the resultset into the JTabel ?" Watch "how to display the resultset into the JTabel ?" New topic

how to display the resultset into the JTabel ?

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

i know that to display data in Jtable is like

but my problem arises when i want to pull the data from the database and used it in the Jtable's constructor i mean
i know that the result of the sql quary "select * from emp" gives me all the data in that table which is holded by Result rs ....
now my question is how i can use this rs which contain my data of table emp so that i will be able to see my data in the JTabel ?
i have done my homework by asking "google" but unfortunately he is not able to help me , so if you experience guyz can show me this thing with a help of a simple example that will be great !

The Only way to learn is!
Visit my blog
Minh Nam
Ranch Hand

Joined: Sep 10, 2011
Posts: 57
Well, a simple way is to iterate over the result to build the vector of data which is passed into table's constructor:

However I suggest you to use a table model to store table data, something like this:

Advanced java topics
I agree. Here's the link:
subject: how to display the resultset into the JTabel ?
It's not a secret anymore!