Solved

How to display an SQL query into a JTable in Netbeans

Posted on 2009-04-04
6
851 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
topping3 challenge 14 80
eclipse java  build path 6 57
jdbc error in jsp application 20 45
Opening PDF on button click and fill new document 2 38
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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 …

773 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