File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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>
It is sorta covered in the JavaRanch Style Guide.
subject: I try to get whole row from database but...
Similar Threads
Please help....confused:
Please help...
number of rows Resultset ???
How can I solve IllegalArgumentException
How can I call my obj in another program?