This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes I try to get whole row from database but... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC
Bookmark "I try to get whole row from database but..." Watch "I try to get whole row from database but..." New topic

I try to get whole row from database but...

Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
Dear Friends,
I try to get whole row but I guess it returns just the last row!!!
Could you please help me?
rs =stmt.executeQuery("select s.text,b.bugNumber,b.bdesc,b.submittedDate,, from bug b, user u, statusDesc s where b.ID=s.ID and b.userId=u.userId and s.text='open'");

/* walk the ResultSet and populate the vector with rows of objects */
ResultSetMetaData rsmd = rs.getMetaData();

while ( {
C_BugList xobj=new C_BugList();
ctx.put("name", xobj );

Col Bell

Joined: Mar 21, 2002
Posts: 12
This is probably your problem

You create a new instance of your BugList object and store it in the collection using the key "name". Because you keep using the same key you will just store the last object. See Map.put(...) in the JDK JavaDoc.
You probably want to do something like

Col<br /><a href="" target="_blank" rel="nofollow"></a>
GeeCON Prague 2014
subject: I try to get whole row from database but...