Solved

How to display an SQL query into a JTable in Netbeans

Posted on 2009-04-04
6
852 Views
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.
0
Comment
Question by:namsu55
  • 3
  • 3
6 Comments
 
LVL 86

Expert Comment

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

Author Comment

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

Expert Comment

by:CEHJ
ID: 24086111
0
Independent Software Vendors: 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!

 

Author Comment

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

Accepted Solution

by:
CEHJ earned 500 total points
ID: 24090444
You just set it directly
table1.setModel(model);

Open in new window

0
 

Author Comment

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

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
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 …

713 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