wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Generate JTable from a SQL Query containing UNION clause Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Generate JTable from a SQL Query containing UNION clause" Watch "Generate JTable from a SQL Query containing UNION clause" New topic
Author

Generate JTable from a SQL Query containing UNION clause

Vaibhav Pingle
Greenhorn

Joined: Nov 23, 2006
Posts: 6
Hello Friends...

Following is the code that i write to convert the Data returned from the ResultSet of an SQL query, to be filled into a JTable.

This code works fine for the normal query....but in the case of a SQL query containing a UNION clause For eg. :

SELECT * FROM Table_1
UNION
SELECT * FROM Table_2


it only returns the results of the first part of the above query..i.e. for

SELECT * FROM Table_1




Please tell me if there are any changes required in this above code OR if there is any SQL driver problem...If its a driver problem, then please tell me what i am suppose to do (I am using MS Access as my database)

Also i wanted to know, how to detect what type of data each column of the ResultSet is returning, and thus display type-specific data in the JTable, especially the Date.
The above code by default displays the date in 2006-11-28 hr:min:sec format, but i want it as dd/MM/yyyy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generate JTable from a SQL Query containing UNION clause
 
Similar Threads
JTable
JTable Question
jtable
JCheckBox in JTable not working
how to "clear" jTable