aspose file tools*
The moose likes JDBC and the fly likes JDBC connection with JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC connection with JTable" Watch "JDBC connection with JTable" New topic
Author

JDBC connection with JTable

MIRANGA_H
Greenhorn

Joined: Jan 27, 2005
Posts: 13
Hi,
i have a oracle table with 3 columns.
i want to populate a JTable by retrieving data from the oracle table. it should populate dynamicaly
Michael Duffy
Ranch Hand

Joined: Oct 15, 2005
Posts: 163
Originally posted by Miranga:
Hi,
i have a oracle table with 3 columns.
i want to populate a JTable by retrieving data from the oracle table. it should populate dynamicaly


Start by writing a single object that does nothing but connect to Oracle and return the data in an object or data structure. (No Swing or JTable needed.) Once you have that working perfectly you can write you Swing UI and have it call your persistence object's methods and display the data that comes back.

Decomposition is always the best way to attack a complex problem. Make the smaller parts work correctly and then knit them together to solve the original problem.


%
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

"Miranga",

You have been warned on two previous occasions to change your display name to conform with Ranch policies. Consider this your third and final warning.

Take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Accounts with invalid display names are removed.

bear
Forum Bartender
[ December 04, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sinasi susam
Ranch Hand

Joined: Jul 15, 2005
Posts: 67
You can use AbstractTableModel to retrieve datas from db table.But you have to extend it in order to use.

First you load datas from table to model and later you gave it to jtable in its constructur.

@Bear is not your name i think,right?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

Originally posted by sinasi susam:

@Bear is not your name i think,right?


Discussion about the naming convention should take place in the JavaRanch forum. My own display name was validated almost 9000 posts ago and is really none of your concern. "Miranga" will need to change his or her display name or the account will be closed.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JDBC connection with JTable
 
Similar Threads
to add a JCheckBox in a JTable cell
JTable
JCheckBox in JTable
JTable not populating
Using JTable