How to display an SQL query into a JTable in Netbeans

Posted on 2009-04-04
Last Modified: 2013-12-29
I currently have a TableModel bound to a table in the database, the values and columns output fine. However, is there any possible way to make an sql query rather than display one table. I have made an SQL View from Netbeans under Services/Databases for the database, but can't seem to use it anywhere for the table model.
Question by:namsu55
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 86

Expert Comment

ID: 24085722
You can make the query using a SwingWorker (see excellent docs) and then set a new DefaultTableModel

Author Comment

ID: 24086017
But would I be able to use foreign keys. Two joined tables in one table model through netbeans.
LVL 86

Expert Comment

ID: 24086111
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.


Author Comment

ID: 24086624
How do I manipulate the Table Model in Netbeans for a JTable.
LVL 86

Accepted Solution

CEHJ earned 500 total points
ID: 24090444
You just set it directly

Open in new window


Author Comment

ID: 24091280
Thanks CEHJ just having a go at it.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SequenceInputStream example 3 38
printf performancy 11 104
jsp CRUD operations with and without prepared statement also hibernatge 1 50
Java Eclipse Loop 3 49
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question