Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes JDBC and Relational Databases and the fly likes inserting queries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "inserting queries" Watch "inserting queries" New topic
Author

inserting queries

duhit Choudhary
Ranch Hand

Joined: Apr 01, 2012
Posts: 64


when i tried to execute this code, it is giving me only one value throughout. but i want all the values given in the xml file... please tell me where am i wrong in this code and how to get different desired values.
thanks a lot...
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19359
    
  10

You only have one object, and you keep adding it to the List. Create a new object each time when you get data from the XML instead of reusing the single object.
duhit Choudhary
Ranch Hand

Joined: Apr 01, 2012
Posts: 64
thank you so much but can you tell me in which line?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19359
    
  10

You don't have an extremely large number of lines where you add an object to a list...
duhit Choudhary
Ranch Hand

Joined: Apr 01, 2012
Posts: 64
i got that line by the way.... but thanks for your help. it was really very helpfull
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19359
    
  10

That's a very common "gotcha", by the way, a lot of beginners get caught doing that.
duhit Choudhary
Ranch Hand

Joined: Apr 01, 2012
Posts: 64
i'll try not to repeat these type of silly mistakes again...
 
 
subject: inserting queries