This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating multiple rows

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Below is my code which creating multiples row.But i want only to create single row.
Can any body tell me where i am wrong .and how to solve this.




Thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are running you insert statement in a loop.
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir..

is looping insert statements good for implementation?..
any suggestion?...

Thanks in advance...
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34401
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Leonardo Carreira wrote:is looping insert statements good for implementation?..
any suggestion?...

It's not the looping is bad if you want multiple rows. (Although using a batch insert would be better.)

Paul meant that your SQL inserts one row per filename. Since you expressed an interest in only having one row overall, he commented the loop would do more than that.
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then how to solve this problem.

Please tell me.

Thanks
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pankaj semwal wrote:Then how to solve this problem.


What exactly you want to insert (in terms of number of records) apart from what Jeanne & Paul suggested? It depends on your requirement.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So your "uploadFileNames" is an array of four strings, and you want those four strings to be the last four of the five columns you will insert into one row? Then don't use a loop:
 
rk palleru
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham said correct answer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic