wood burning stoves 2.0*
The moose likes JDBC and the fly likes Using Vectors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using Vectors" Watch "Using Vectors" New topic
Author

Using Vectors

Martin Schneider
Ranch Hand

Joined: May 16, 2002
Posts: 42
How I can make this work:

Now I get an empty table :| I know it is caused when I clear temp vector but I dont know how to make it work the way I need..
Edit: Nice work :|
[ May 24, 2002: Message edited by: Martin Schneider ]
[ Edited by Dave to fix the smiley ]
[ May 24, 2002: Message edited by: David O'Meara ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

rather than clearing the Vector each time, create a new one for each use.

( add is preferred to addElement as of JDK1.2 so that it fits into the Collections Framework)
Dave
Martin Schneider
Ranch Hand

Joined: May 16, 2002
Posts: 42
Thanks,
but I was wondering if that kind of solutions is good if I need to select many rows from db and then print those to screen? In other word are vectors right way to deal in such an issue?
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Originally posted by Martin Schneider:
Thanks,
but I was wondering if that kind of solutions is good if I need to select many rows from db and then print those to screen? In other word are vectors right way to deal in such an issue?

using a Vector might be overkill, if you don't need the synchronization aspect of the Vector, then try using an ArrayList. It is the equivalent to Vector but without the overhead of the synchronization.
define "many rows" for us. To some 50 rows is many, to others 10,000 rows is many...etc. How many rows do you expect?
Jamie
Martin Schneider
Ranch Hand

Joined: May 16, 2002
Posts: 42
Ok, so I'd say I need to print 100 rows at maximum. Another aspect that is supposed to implement is ability to modify those rows. If I use table to display rows, is there any way to let user modify information?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Using Vectors