• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC connection with JTable

 
MIRANGA_H
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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 ]
 
sinasi susam
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic