True. I hadn't spotted the declaration within the for loop.
They are not both 0 based. ResultSet.getXXX() is 1 based.
So : record[i] = rs.getString(i+1);
Vivek Moyal
Ranch Hand
Joined: Nov 02, 2009
Posts: 57
posted
0
You are saying that my Swing code is ok and in different thread of JDBC everyone is said that the code is ok so please tell me where is the problem than
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
> You are saying that my Swing code is ok and in different thread of JDBC everyone is said that the code is ok so please tell me where is the problem than
No, I'm saying that it (possibly) looks like your code is in the wrong order
i.e. you have 2 lines inside the 'for loop' that should be outside of it,
1 line should precede, 1 line should follow.
I don't have your db stuff, so it's up to you to make the changes (see my first reply),
and test to see if they work. If not, post what happened (as in any differences to what you have now)
Vivek Moyal wrote:You are saying that my Swing code is ok and in different thread of JDBC everyone is said that the code is ok so please tell me where is the problem than
That was me. Michael did a better job in finding the issues.
Rob Camick
Ranch Hand
Joined: Jun 13, 2009
Posts: 1788
2
posted
0
Well, the above looks like your code to create the TableModel. A I see it you are only adding a single "record" to the model and the value of "record" is the last row you read from the ResultSet.
To create a DefaultTableModel you need a Vector of Vectors. So you create a Vector as your main Vector. Then for every row in the ResultSet you create a new Vector and add the data from each column to it. So basically your code is correct expect instead of using an ArrayList of String[] you should be using a Vector of Vectors and then you can use that Vector directly to create the model.
Getting the whole record but one record is in one column and another is in another column record is whole but it is not distributed according to the columns
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.